top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Angular (2/4/5), How to toggle the class name by clicking the element?

0 votes
609 views
In Angular (2/4/5), How to toggle the class name by clicking the element?
posted Jan 17, 2018 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Using ngClass Attribute we can toggle the classname

<button [ngClass]="type === '1' ? 'show': 'hide'></button>

Based on the type value show and hide class name will change

answer Aug 26, 2018 by Pardeep Kohli
...