Search example
Showing posts with label ng-class if example. Show all posts
Showing posts with label ng-class if example. Show all posts

Angularjs table format example

 Angularjs table format example

Requirement:
Have a list customers, show customer information (name, age, gender, phone) as a table.
To make discern base on gender: if gender = 'girl' then textcolor will be green
To make discern base on age: if age <20 background of age cell will be blue (is teen)

                                                if age >60 background of age cell will be gray(is old)

As same as following image

Here is full code, please focus at highlight chars.

ng-class if example


How to apply  ng-class if

This example provides two ways using ng-class if expression.
Following directives and services in angularjs will be used:
  • ng-classs
  • ng-model
  • ng-repeat

Popular Posts