Demo Url
http://jsfiddle.net/wittwerj/gm7mz/
app.js
angular.module("app",[]).controller("appcontrol", function($scope, $http) {
$scope.categories = [
{name:'Dry/Baking Goods ', order:'0'},
{name:'Frozen Foods', order:'1'},
{name:'Produce', order:'2'},
{name:'Meats', order:'3'},
{name:'Dairy', order:'4'},
{name:'Snacks', order:'5'},
{name:'Beverages', order:'6'},
{name:'Bread/Bakery', order:'7'},
{name:'Canned/Jarred Goods', order:'8'},
{name:'Cleaners', order:'9'},
{name:'Paper Goods', order:'10'},
{name:'Personal Care', order:'11'},
{name:'Other', order:'12'}
];
$scope.items = [
{text:"Butter", category: $scope.categories[0]},
{text:"Lemons", category: $scope.categories[2]}
];
});
<div ng-app="app" ng-controller="appcontrol">
<select ng-repeat="item in items" ng-model="item.category"
ng-options="category as category.name for category in categories">
</select>
</div>
http://jsfiddle.net/wittwerj/gm7mz/
app.js
angular.module("app",[]).controller("appcontrol", function($scope, $http) {
$scope.categories = [
{name:'Dry/Baking Goods ', order:'0'},
{name:'Frozen Foods', order:'1'},
{name:'Produce', order:'2'},
{name:'Meats', order:'3'},
{name:'Dairy', order:'4'},
{name:'Snacks', order:'5'},
{name:'Beverages', order:'6'},
{name:'Bread/Bakery', order:'7'},
{name:'Canned/Jarred Goods', order:'8'},
{name:'Cleaners', order:'9'},
{name:'Paper Goods', order:'10'},
{name:'Personal Care', order:'11'},
{name:'Other', order:'12'}
];
$scope.items = [
{text:"Butter", category: $scope.categories[0]},
{text:"Lemons", category: $scope.categories[2]}
];
});
<div ng-app="app" ng-controller="appcontrol">
<select ng-repeat="item in items" ng-model="item.category"
ng-options="category as category.name for category in categories">
</select>
</div>
0 comments:
Post a Comment