Monday 15 March 2010

AngularJS: need to split/parse ng-options value -



AngularJS: need to split/parse ng-options value -

a legacy database working stores lookup values in semi-colon separated list (within single field/column in table) - worked fine info source asp.net. migrating angularjs - i've found no way intercept value , split separate options in select element.

in select drop downwards shows (for example) "1 rep; 2 reps; 3 reps" etc.

can suggest how split value select options render vertically - each 1 in it's own alternative row?

this how select element looks now:

<select ng-model="exercisevals[$index].reps1" ng-options="value.reps value.reps (key,value) in lkps ></select>

ng-options works on array or object.

if understand situation correctily, you're getting big string server semicolon-separated entries. need split array.

$scope.lkps = stringfromserver.split(";");

then in html:

<select ng-model="selectedval" ng-options="item item in lkps"> </select>

angularjs ng-options

No comments:

Post a Comment