ng-if inside ng-repeat in angularjs -


i generating dynamic form in angularjs:

<div ng-repeat="choice in mydata" class='repeater'>     <div ng-if="choice.type === 'dropdown'" ng-init="count = 0">         <div class="row">             <div class="col-md-2">                 <p>choose</p>             </div>             <div class="col-md-8">                 <select ng-model="selected" ng-options="item.value item in mydatedropdown[count]"> </select>             </div>         </div>         {{count += 1}}     </div> </div> 

i unable increment value of count , assign mydatedropdown[]. new angularjs.

you try changing ng-repeat <div ng-repeat="(index, choice) in mydata" class='repeater'> , use index in mydatedropdown

<div ng-repeat="(index, choice) in mydata" class='repeater'>     <div ng-if="choice.type === 'dropdown'" ng-init="count = 0">         <div class="row">             <div class="col-md-2">                 <p>choose</p>             </div>             <div class="col-md-8">                 <select ng-model="selected" ng-options="item.value item in mydatedropdown[index]"> </select>             </div>         </div>     </div> </div> 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -