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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -