Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

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.

1 Answer

0 votes
by (106k points)
edited by

You can use the ternary operator as follows:-

Looking for Angularjs material from basics! Refer to this video on Angularjs provided by Intellipaat:

<li ng-class="$first ? 'firstRow' : 'nonFirstRow'">

Related questions

+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...