Skip to content

Instantly share code, notes, and snippets.

@shangoyanyi
Last active November 2, 2015 05:42
Show Gist options
  • Save shangoyanyi/91507486200e10180bf1 to your computer and use it in GitHub Desktop.
Save shangoyanyi/91507486200e10180bf1 to your computer and use it in GitHub Desktop.
Angular - solve the conflict between ng-route and bootstrap
/*
* bootstrap can use <a href='#' class='some-class' >link</a> as a button,
* and angular catches <a>link</a> click event to do the route.
* this is how to prevent the routing being triggered when user click the button.
*/
$scope.doThings = function($event){
$event.stopPropagation(); //prevent event propagation
//some other things to do
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment