angular.js - Can angular applications directly obtain elements in html and pass them into functions as parameters?
过去多啦不再A梦
过去多啦不再A梦 2017-05-15 17:03:04
0
1
502

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?

过去多啦不再A梦
过去多啦不再A梦

reply all(1)
世界只因有你

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));
};
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template