I am getting a ng-class like this in my dom, how can i access the twitter and yahoo attributes here.
ng-class="{twitter:2 < id , yahoo :2 >id}"
typeof ng-class is object, but when i try to access it like elem["ng-class"]["twitter"] does not work.
While doing JSON.parse(obj) also fails.
Uncaught SyntaxError: Unexpected token t in JSON at position 1
JSON.parsewon't parse it...twitterandyahooin your conditional class, we can probably give you some better options.ng-classin my experience.ngClassdirective understands that syntax, and will give the element the classtwitterif the expression is true and won't if it's false.