简体   繁体   中英

Does a ng-model work on ng-repeated fields?

I am using ng-repeat and I am various levels in such as:

`ul in output.content.innercontent` or `li in ul.content.innercontent`

my input looks like this:

 <input id="{{input.key}}" name="{{input.label}}" type="text" 
        value="{{input.value}}" placeholder="{{input.defaultValue}}" 
       value="{{input.label}}" 
       class="form-control input-md" uib-tooltip="{{input.tooltip}}" 
       ng-if="input.type == 'input'">

On any one of those whenever a change happens and then an onBlur I want to make a call. Is this possible with ng-model & ng-model-options="{updateOn:'blur'}" with all these fields? The bind behavior I see online are mostly of an input to read-only field somewhere. Should I use ng-blur followed with a on("change") type of behavior?

try with

 <input id="{{input.key}}" name="{{input.label}}" type="text" 
    ng-model="{{input.value}}"  <!-- this -->
   placeholder="{{input.defaultValue}}" 
   class="form-control input-md" uib-tooltip="{{input.tooltip}}" 
   ng-if="input.type == 'input'">

ng-model should do it


 <input ng-model-options"{updateOn: 'blur'}"/>

==> This update the model only when user get outside the input


To call a function on-blur :

 <input ng-blur="callThisFn()"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM