angular.js - angular应用能否直接在html中获取元素作为参数传入函数
过去多啦不再A梦
过去多啦不再A梦 2017-05-15 17:03:04
0
1
467

angular应用,请问如何使能够直接在 html 中使用jquery获取元素并作为参数传入函数呢?

<button ng-click="vm.getButton($(this))"></button>
var ctrl = this;
ctrl.getButton = (elem) => {
    console.log(elem);
};

函数里面的 this 直接指向了当前scope,无法获取到元素,请问有解吗?

过去多啦不再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