【发布时间】:2014-04-25 18:02:48
【问题描述】:
我需要处理对启用弹出框打开的标签的点击。
我尝试找出使用 angularjs 并自然使用 hg-click 的最佳方法。
<div ng-repeat="photo in stage.photos"
ng-click="openPopoverImageViewer($(this))"
>
$scope.openPopoverImageViewer = function (source) {
alert("openPopoverImageViewer "+source);
}
问题是我无法将 $(this) 传递给它。
Q1) 如何传递jQuery 元素?
Q2) 此外,ng-click 声音 要求该功能成为控制器的一部分:是否可能 改为在部分中调用函数?
【问题讨论】:
-
看起来你需要创建一个指令。 docs.angularjs.org/guide/directive.
标签: angularjs angularjs-ng-click