VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-class-even-directive/

⇱ AngularJS ng-class-even Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-class-even Directive

Last Updated : 11 Jul, 2025

The ng-class-even Directive in AngularJS is used to specify the CSS classes on every even appearance of HTML elements. It is used to dynamically bind classes on every even HTML element. If the expression inside the ng-class-even directive returns true then only the class is added else it is not added. The ng-repeat directive is required for the ng-class-even directive to work. It is supported by all HTML elements. 

Syntax:

<element ng-class-even="expression"> 
 Contents... 
</element>

Parameter value:

  • expression: This parameter returns more than one class name or simply specifies the CSS class for even appearance of HTML elements.

Example 1: This example uses the ng-class-even Directive to select even elements and apply CSS property. 

Output:

👁 ngclasseven

Example 2: This example describes the ng-class-even Directive in AngularJS, where even elements are selected, in order to change its font-size & the text color.

Output:

👁 Image
 
Comment

Explore