angularjs - Can I use an array for ng-options instead of an object? -
if have utilize ng-options list instead of object, how can iterate on ?
here code controller
angular.module("mainapp") .controller('newcontroller', [ "$scope", function ($scope, $modalinstance, data) { $scope.data = data; $scope.sex = ["male", "female"]; } ]); here html5 code, gives me error
<div ng-controller="new controller"> <label class="select"> <select ng-model="sex" ng-options="for s in sex" > <option value="" selected="" disabled="">sex</option> </select> <i></i> </label> </div>
what want this:
$scope.sex = ["male", "female"]; $scope.selection = ""; <select ng-model="selection" ng-options="s s in sex"> plunker example
angularjs
No comments:
Post a Comment