Having the following HTML inside a <span>
element:
<span (click)="openLeft()"></span>
A method in a @Component
sets a boolean variable like so:
private isOpen: boolean;
openLeft() {
this.isOpen = !this.isOpen;
}
To toggle classes on another element similar to jQuery, we need to do:
$('.collapse').toggleClass('in').toggleClass('hidden-xs').toggleClass('visible-xs');
We want these classes added or removed based on the boolean variable value.
How can this task be accomplished?