How To Toggle A Class In IONIC 4

[Total: 1    Average: 5/5]
<button (click)="clickEvent()"> click me </button>
<div class="my_class" [ngClass]="status ? 'notactive' : 'isactive'">
<p> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium rerum repellat, impedit nulla odit
laboriosam a ducimus repudiandae ex iure, obcaecati officiis alias ratione nisi molestias? Officia dolorum id
reprehenderit!</p> 

 

 

 

// ts file code
status: boolean = false;
clickEvent(){ this.status = !this.status; }



admin
Leave a Reply

Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages