4

I have a table with a number of rows, each can be selected, on the first column is an info button using bootstraps popover (UI Bootstrap Angular).

<span class='glyphicon glyphicon-info-sign' popover-placement='right' popover='my notes to display'></span>

When I click on the item I want it not to select the item behind it.

I know this can be accomplished using e.preventDefault and e.stopPropagation(), how do I implement this with bootsrap UI?

Thanks

4
  • 1
    You can use $event.preventDefault() in angular. Commented Feb 18, 2014 at 14:51
  • How would that work with UI Bootstrap, ui bootstrap seems to just work with attributes? Commented Feb 18, 2014 at 14:57
  • 1
    I said you can use it in angular views. So in your case I think you used angular so you can use it like ng-click="$event.preventDefault()". If not then tell your problem in detail. Commented Feb 18, 2014 at 15:00
  • almost right. but instead of preventDefault one should use here stopPropagation to avoid the event bubbling up. Commented Feb 18, 2014 at 15:17

1 Answer 1

7

Tell it to stop propagating events like so:

 <span ng-click="$event.stopPropagation()" class='glyphicon glyphicon-info-sign' popover-placement='right' popover='my notes to display'></span>

That should help.

Sign up to request clarification or add additional context in comments.

3 Comments

plnkr.co/edit/2ot0FLCUQwj1gogBLON9?p=preview clicking the i glyph triggers only its own event and not its parent event from the button.
thanks, that did the trick... because I'm rendering the code from inside a controller. some hacky stuff I didn't want to use compile with you example so i've done the following onclick='(function(e) { e.stopPropagation(); })'
I had to use $event.preventDefault(); for this to work in Angular6 in Chrome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.