以下是代码:
<div ng-click="grid.appScope.navToPage(row)"class="ui-grid-cell" ui-grid-cell style="cursor: pointer">
<div class="ui-grid-cell-contents">
<a ng-href="/mywebpage/2" target="_blank">
<span class="glyphicon glyphicon-new-window"></span>
</a>
</div>'
</div>
我想找出一些方法可以点击标记链接,而无需点击ng-click
的div。有没有办法做到这一点?
答案 0 :(得分:6)
您可以使用许多角度指令(例如$event.stopPropagation()
)上提供的ng-click
来阻止点击传播。请查看此问题AngularJS ng-click stopPropagation
在您的情况下,锚标记应如下所示:
<a ng-href="/mywebpage/2" ng-click="$event.stopPropagation()" target="_blank">
<span class="glyphicon glyphicon-new-window"></span>
</a>
答案 1 :(得分:2)
试试这个
<a ng-href="/mywebpage/2" target="_blank" ng-click="$event.stopPropagation()"><span class="glyphicon glyphicon-new-window"></span></a>