我有一些代码要与 animate.css 一起使用,以在 div 中添加和删除类。
这是代码:
app.component.html
<button (click)="toggleMethod()">Toggle Classes</button>
<div class="myDiv">
// Stuff here
</div>
app.component.ts
toggle = false;
toggleMethod() {
if (this.toggle === true) {
//Do this without JQ $('.myDiv').removeClass('animate__animated animate__fadeInLeft');
} else if (this.toggle === false) {
//Do this without JQ $('.myDiv').addClass('animate__animated animate__fadeInLeft');
}
this.toggle = !this.toggle;
}
在不使用 jQuery(Angular 方式)的情况下如何执行上述操作?