javascript - Angularjs alway blank element in select tag -


i new angular.js (and forum) , want try out basics, got stucked @ working select , options.

i have small app , want add select-box, blank option want rid of.

i searching here on stackoverflow and, of course, google, , tried out may options , hints, nothing seems work me.

i hope can me here...

about app: have items attribures item.name or item.price etc. , want store value of selected tag item.store.

this part of view:

<td> <select ng-model="item.store" ng-options="item.storename item in items.stores"> </select></td> 

and have in controller:

$scope.items.stores = [     {storeid : 1, storename : 'spar' },           {storeid : 2, storename : 'billa' },     {storeid : 3, storename : 'merkur' },  ]; 

amongst others tried one:

$scope.item.store = $scope.items.stores[1]; 

but error message: "$scope.item undefined...." although ng-model named item.store, assume there problem . or that...

thanks , if relevant code missing, please tell me :-)

have plunker contains modifications mentionned in comments of op.

$scope.items = {     stores: [       {id : 1, name : 'spar' },             {id : 2, name : 'billa' },       {id : 3, name : 'merkur' },      ] };  $scope.item = {     store: $scope.items.stores[1] } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -