angular应用,请问如何使能够直接在 html 中使用jquery获取元素并作为参数传入函数呢?
<button ng-click="vm.getButton($(this))"></button>
var ctrl = this; ctrl.getButton = (elem) => { console.log(elem); };
函数里面的 this 直接指向了当前scope,无法获取到元素,请问有解吗?
this
Currently, the requirements are implemented through the following methods
<button ng-click="vm.getButton($event)"></button>
var ctrl = this; ctrl.getButton = ($event) => { console.log($($event.currentTarget)); };
Currently, the requirements are implemented through the following methods