class directive in angular code example Example 1: ng class [ngClass]="{'text-success':person.country === 'UK'}" Example 2: ng class project ngDoCheck()