javascript - Access ng-model from one div to another div -
i want access ng-model value 1 div div.
html:
<div class="form-group" ng-repeat="key in condition.keys"> <select class="form-control" ng-show="key.aggregator" ng-model="key.aggregator" ng-options="field.name field.label (name, field) in aggregators"></select> <select class="form-control" ng-model="key.field" ng-options="s.field s.field s in subschema($parent.condition,$index)" ng-change="onfieldchange($parent.condition,$index)" required> <option value="">choose one</option> </select> </div> <div class="form-group mb-left">{{key.field}} <select class="form-control" ng-model="condition.operator" ng-options="field.name field.label (name, field) in fields | instancefilter :key.field :condition" required> <option value="">choose operator</option> </select> </div> </div> as can see there key.field in ng-model in 1 div. want access ng-model value on div can see instancefilter. possible? in adavnce please solve issue
in general, can use same ng-model binding in many divs sit under same scope.
it's not obvious code trying accomplish, "key.field" binding within ng-repeat div not in same scope rest of page outside ng-repeat.
you should assign both ng-model="key.field" different variable on outer scope , not part of key has scope individual item in collection.
Comments
Post a Comment