How do ng-options
and ng-repeat
differ?
In the following code, I have an ng-repeat
that iterates through a list of people:
ng-repeat give problem while send information back to controller because in general we show name to the user but use ID/Index of the option for backend operations.
Simple words- with ng-options you may use complete JavaScript object.
{{selectedName}}
{{selectedName.age}}
but with ng-repeat you have to deals with string.
{{selectedName}}
{{selectedName.age}}
This example shows how to fill a dropdown list using the ng-repeat directive.