Tobias Koller Tobias Koller - 1 year ago 189
AngularJS Question

angular ui router disable for some links

i would like to use the bootstrap accordion in my angular-application.
I'm using the angular ui-router for Routing through the sites.

Now I'm facing a problem that the accordion needs an

<a href="#CollapseOne"> Tag.

The problem is that the ui-router "thinks" it has to do something and tries to navigate to "#CollapseOne".

How can I stop ui-routing on some ?

Answer Source

You can use $urlRouterProvider.when() with a do nothing handler function to stop routing for some URLs

$urlRouterProvider.when("/CollapseOne", function() {
  //do nothing

Alternatively simply replace href with data-target which will fix your problem

<a data-target="#CollapseOne" data-toggle="collapse">Tag</a>.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download