javascript - input text isn't updating angular model in one case that is identical to another in the same form -
i have simple form (reduced actual form demonstrate problem):
<pre>name: {{currentchild.name}}</pre> <pre>annual college expense: {{currentchild.annualcollegeexpense}}</pre> <form name="childform" novalidate> <div class="form-inline"> <div class="form-group"> <label>name:</label> <input type="text" name="name" class="form-control" ng-minlength="1" ng-model="currentchild.name" ng-required="true"> <div class="help-block" ng-messages="childform.name.$error" ng-show="childform.$submitted || childform.name.$dirty || (childform.name.$invalid && childform.name.$touched)"> <p ng-message="required" ng-hide="childform.name.$valid">your name required.</p> <p ng-message="minlength" ng-hide="childform.name.$valid">your name short.</p> </div> </div> <div class="form-group"> <label>annual expenses:</label> <input type="text" name="annualcollegeexpense" class="form-control" ngmodel="currentchild.annualcollegeexpense" /> </div> </div> </form>
when fire form, see expected data in pres @ top of form. when type name field, name in pre changes. when type annual expense field, annual expense pre not change.
since these identical , appear obey usual ng-model rules, i.e., use . reference data in model, i'm stumped.
anybody got suggestion?
you used ngmodel
instead of ng-model
should use
ng-model="currentchild.annualcollegeexpense"
instead of
ngmodel="currentchild.annualcollegeexpense"
use
<input type="text" name="annualcollegeexpense" class="form-control" ng-model="currentchild.annualcollegeexpense" />
Comments
Post a Comment