You don't need to use jquery, just change your click binding on view to (click)="myFunc($event)", and on myFunc change to:myFunc(e) { const target: HTMLElement = e.target; target.classList.toggle('active');} 这篇关于toggleClass()在Angular 4中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 01:56