AngularJS - Add style to option -


i have code:

<select ng-options="key value (key, value) in {{set.values}}" ng-init="set.value" ng-model="item.styles[group][name].value"></select> 

i need set style options (generated):

<option style="background: green;"> <option style="background: red;"> 

how? possible? or need directive or other fancy code?

you can apply conditional styles via angular's built-in ng-style directive

markup

<span ng-style="mystyle">sample text</span> 

logic

$scope.mystyle = {    background: '#000000' }; 

where directive takes valid expression

see also:

how conditionally apply css styles in angularjs?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -