2

Here is the code:

<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>

I want to figure out some way to be able to click the a tag link without clicking the div with the ng-click. Is there a good way to do this?

Kristijan Iliev
  • 4,901
  • 10
  • 28
  • 47
Lotus_8
  • 159
  • 2
  • 11
  • How about this: http://stackoverflow.com/questions/5549840/jquery-keep-a-link-clickable-in-clickable-div – ppasler Dec 28 '16 at 18:27

2 Answers2

7

You can prevent click propagation using the $event.stopPropagation() which is available on many angular directives such as ng-click. Please have a look at this question AngularJS ng-click stopPropagation

In your case, the anchor tag should look like this:

<a ng-href="/mywebpage/2" ng-click="$event.stopPropagation()" target="_blank">
   <span class="glyphicon glyphicon-new-window"></span>
</a>     
Community
  • 1
  • 1
Kristijan Iliev
  • 4,901
  • 10
  • 28
  • 47
2

Try this

<a ng-href="/mywebpage/2" target="_blank" ng-click="$event.stopPropagation()"><span class="glyphicon glyphicon-new-window"></span></a>
Matuszew
  • 841
  • 5
  • 12