javascript - Adding and removing class through ng-class based on attribute value -


consider below markup. it's case of accordion. have apply different css (background color) 1 open. wish use ng-class directive. header open has aria-expanded attribute set true. being false others.

<v-pane-header class="header ng-scope ng-isolate-scope" role="tab" tabindex="0" aria-selected="true" aria-expanded="true"> 

how can accomplish this. know how respect model variable etc. note aria-expanded attribute automatically added accordion plugin.

i took different approach solving issue. instead of doing through ng-class or other function or method in code, worked on accordion plugin itself. accordion adds aria-expanded attribute dynamically. made changes in plugin code , applied style attribute right plugin adds aria-expanded attribute. it's working perfectly.

function expand() {     accordionctrl.disable();      panecontent.attr('aria-hidden', 'false');      paneheader.attr({         'aria-selected': 'true',         'aria-expanded': 'true',         'style': 'background-color:#fff0c9 !important'  // added style here. can add class though.      });      emitevent('onexpand');     // rest of code...... 

this not answer question of doing through ng-class nevertheless gives possible approach trying achieve similar thing.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -