我正在尝试"stopPropagation“,以防止当点击安莉内部的元素(链接)时,Twitter Bootstrap导航栏下拉菜单关闭。使用这种方法似乎是常见的solution。
在Angular中,看起来像是一条指令是做这件事的地方?所以我有:
// do not close dropdown on click
directives.directive('stopPropagation', function () {
return {
link:function (elm) {
$(elm).click(function (event) {
event.stopPropagation();
});
}
};
});..。但该方法不属于元素:
TypeError: Object [object Object] has no method 'stopPropagation'我将指令与
<li ng-repeat="foo in bar">
<div>
{{foo.text}}<a stop-propagation ng-click="doThing($index)">clickme</a>
</div>
</li>有什么建议吗?
https://stackoverflow.com/questions/14544741
复制相似问题