One of the challenges I'm facing is transferring a value set by the user in an ng-model from one form field to another ng-model as the initial value within the same form.
For example, I want the ng-init value of myModel.fieldB
to be the value myModel.fieldA.subfield
. This evaluation is working successfully in the value displayed within the span element. However, it's not updating the ng-model for myModel.fieldB
, meaning that
ng-init="myModel.fieldB = myModel.fieldA.subfield"
isn't functioning as expected.
Strangely enough, when passing string literal values, such as in
ng-init="myModel.fieldB = 'some example'"
, everything works correctly.
<span class="form-group" ng-model="myModel.fieldB" ng-init="myModel.fieldB = myModel.fieldA.subfield">{{myModel.fieldA.subfield}}</span>