Hi All,
I have been struck while creating select field dynamically inside a
ng-repeat. Below is the piece of code I am using.
<div ng-repeat="item in actionLabels">
<!-- Setting select field model dynamically using loop index -->
<select ng-model="formValues.selectedActionLabelOptions[$index]"
ng-options="obj.optionId as obj.optionDescription for obj
in actionLabelOptions>
ng-change="showRespectiveInput()"
<option value="Select">Select</option>
</div>
I want to add a condition to ng-options. condition is :
If($index == 0 && optionId == 5) then I don't want to add this option to
select field. i.e for the first time when loop executes the 5th option in
the select field ll not appear.
I am not sure where to put this condition.
I tried with following piece of code by creating ng-option through
ng-repeat:
<option ng-repeat="option in actionLabelOptions" ng-hide="$parent.$index ==
0 && option.optionId == 5">
This works fine to generate options for respective rows. i.e for the first
row 5th option never comes. But *ng-change* event is not fired.
Can anyone help me regarding this?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.