Can you use objects instead of arrays with ng-option and AngularJS -


i using ng-options populate items in select menu.

ng-options="i.option in week.items" 

with array populate items.

week.items = [   {     'option': '8 week single transformation | 2 payments of $198.50',     'price' : 198.5   },   ....   {     'option': '8 week partner transformation | $597',     'price' : 597   }]; 

is possible use object instead of array, or ng-options set work arrays?

yes can so. docs well. here example object

$scope.letters = {     'a': 1,     'b': 2    }; 

and html

ng-options="letter (letter, value) in letters" 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -