html5 - HTML select with angular bind -



html5 - HTML select with angular bind -

i doing mockup page using angular js , html only. wonder if there faster can dynamic bind selected value in html angular object such if have sth like:

item.dropdownvalue = 0; <select> <option value=0>pre-launch</option> <option value=1>active</option> <option value=2>complete</option> </select>

that can bind dropwown turn be:

<select> <option value=0 selected>pre-launch</option> <option value=1>active</option> <option value=2>complete</option> </select>

just html dropdown helper in mvc5

simplified:

if you're wanting impact selected state, can own html , bind scope value selected alternative via ng-model. see simplified plunker @ http://plnkr.co/edit/yiwbheqokdfgjkmv9qvy?p=preview

original answer:

this can accomplished having array values , building select ng-options angular directive:

<select name="state" ng-model="dropdownvalue" ng-options="states.indexof(state) state state in states"></select>

you can see in action in next plunker: http://plnkr.co/edit/hy9zpzbe9mhrycvdntgi?p=preview

html5 angularjs asp.net-mvc-5

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -