【发布时间】:2016-09-27 04:47:38
【问题描述】:
在指令中,单击 jQuery 元素时,我正在更新范围。但它不起作用。这样做的正确方法是什么?
angular.module('app.directives', []).directive('newContent', function() {
return {
link: function(scope, element, attrs) {
var title = element.find('h1'); //getting the element
scope.show = true;
var that = scope;
title.on('click', function(){
scope.show = false; //not working
})
}
}
})
【问题讨论】:
标签: jquery angularjs angular-directive