How do you do a ternary with AngularJS (in the templates)?
It would be nice to use some in html attributes (classes and style) instead of creating and calling a function of the controller.
How do you do a ternary with AngularJS (in the templates)?
It would be nice to use some in html attributes (classes and style) instead of creating and calling a function of the controller.
if anyone is still working on legacy code like I'm you can also achieve this using a ternary operator inside ng-style like so:
<li ng-style="{'color': connected ? '#008000' : '#808080'}"></li>