Angular application, how can I use jquery directly in html to obtain elements and pass them into functions as parameters?
<button ng-click="vm.getButton($(this))"></button>
var ctrl = this;
ctrl.getButton = (elem) => {
console.log(elem);
};
The in the this
function directly points to the current scope, and the element cannot be obtained. Is there any solution?
世界只因有你2017-05-15 17:05:04
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));
};