0

I need to add a class 'test1' if the values in 'emp_code' and 'emp' is same.

I had tried with the code,

class="{{ emp_empcode == emp ? 'test1' : 'test2' }}"

I had tried with this and this

Any other way? Thanks a lot in advance.

1 Answers1

2
[class.test1]="emp_code == emp"

should definitively work. You can also take a look at https://toddmotto.com/ng-class-angular-classes for more varieties

yannick
  • 685
  • 1
  • 11
  • 29