angularjs - ng-options taking value from 0,1,2...., instead of using Id given in option -


i have data this

localitems =       [{id: 234565, name: "my class"},        {id: 871243, name: "class 321"}]; 

i using in template,

ng-options="item.id item.name item in localitems"//used work 

my angularjs version 1.2.15

what want:

<option value="234565">my class</option> <option value="871243">class 321</option> 

what getting:

<option value="0">my class</option> <option value="1">class 321</option> 

it worked every time, don't understand why not working

is because id value's large?

if want have property value assigned right id use track by:

ng-options="item.id item.name item in localitems track item.id" 

but ng-model assigned right value anyway

working jsfiddle : http://jsfiddle.net/kn9xx/20/


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -