Differences between ng-repeat and ng-options
$scope creation :
ng-repeat - For every iteration over the collection it will create the new $scope
ng-options - For every iteration over the collection it will not create the new $scope
ng-repeat - For every iteration over the collection it will create the new $scope
ng-options - For every iteration over the collection it will not create the new $scope
Performance :
ng-repeat – Performance will be degrade if the length of collection is huge.
ng-options – Performance is great when compared with ng-repeat.
Data type holding with model :
ng-repeat – ngrepeat associated with the ngmodel can hold only string type.
ng-options – ngoption associated with the ngmodel can hold even objects.
ng-repeat – ngrepeat associated with the ngmodel can hold only string type.
ng-options – ngoption associated with the ngmodel can hold even objects.
Association with ng-model :
ng-repeat – Not mandatory to have the ng-model directive.
ng-options-It’s mandatory to associate with the ng-model when we prefer ng-options
Syntax :
ng-repeat
-
<select id="test"><option ng-repeat="x in dept">{{x}}</option></select>
ng-options -
<select id="Select1" ng-model="selectedon" ng-options="x for x in
dept"></select>
ng-repeat : https://angularsubject.blogspot.in/2017/10/ng-repeat-in-angular-js.html
ng-options : https://angularsubject.blogspot.in/2017/10/dropdownlist-in-angular-js.html
No comments:
Post a Comment