Search code examples
angularjslaravelinput-field

Why is angular making my inputfield empty?


The value of my inputfield is set but why is my inputfield still empty ? I am using a combination of laravel en angular :

inputfield html :

<input 
        type="text" 
        name="name"
        value="{{ old('name') }}" 
        ng-model="name"
        ng-model-options='{ debounce: 300 }'
        class="form-control"
        ng-class="{ enabled : nameIsValid }"
        ng-change="checkName(name)"
        placeholder="Your nickname"
        required>

Solution

  • It is hard to tell the reason if you don't put your controller code in here. But here are some assuptions from my part:

    1. you don't need to set the value if you bind an input-field with ng-model.
    2. rather then ng-change I would use a $scope.$watch() function
    3. are you using more than one scope in this template? maybe changes made by the child-scope aren't altering the original variable of the $parent-scope