Thursday 16 May 2019

Adding multiple class using ng-class in Angularjs

Introduction:- in this article we will learn how to apply multiple class in angularJs.


Definition:- we can apply classes multiple way some of them in this way.

1. ng-class using array syntax:
ng-class="{expression1:'class1',expressionData2:'class2'}[Status]"
2. Adds 'odd' or 'even' classes to div
ng-class="[{0:'even', 1:'odd'}[ $index % 2]]"
3. ternary operator notation:
 ng-class="expression1? 'class1 class2' : 'class3 class4'"
4. we have multiple expression to add multiple ng-class.

 ng-class="{class1: expressionData1, class2: expressionData2}"
ng-class="{class1 : expression1, class2 : expression2}"> Hello World!

No comments:

Post a Comment

What is Agile,advantage and disadvantages

Introduction:- It is a software development life cycle used for software development, that is characterized by the division of tasks in...