0

I found few questions with the same topic, but none of them were matching to my criteria. Hence posting it back.

Otherwise condition in routing is messing up with many of our static url's.

$routeProvider.otherwise({redirectTo: "/404"});

Otherwise condition is set for 404 page.

We have used # For no url re-directing for some links,

Ex : <a href="#">Test</a>

So onlick of this, its redirecting to 404 page not found. But it should remain in the same page and state. How?

And currently working on bootstrap carousels and carousel arrows look like this:

<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>

Above two links instead of helping in sliding redirecting for 404 page. How to restrict this and so on if we want to preventDefault routing for any other links from external plugins?

Mithun Shreevatsa
  • 3,588
  • 9
  • 50
  • 95
  • 1
    Try with `target="_blank"` in anchor tag – Satpal Nov 17 '14 at 11:13
  • 1
    you should also use ng-href instead of href. https://docs.angularjs.org/api/ng/directive/ngHref – sam Nov 17 '14 at 11:18
  • The answer is so simple, i did not think of it... It worked for #myCarousel but not for just # @Satpal – Mithun Shreevatsa Nov 17 '14 at 11:18
  • Just give `Test`. Giving # will try to load url which is "/" – CodingNinja Nov 17 '14 at 11:22
  • Thanks for your reply @CodingNinja. Not that useful or cant compromise, need to ignore it... As i have many files written already using # tag. Cant change now in all the files... – Mithun Shreevatsa Nov 17 '14 at 11:24
  • Maybe you can change the hash prefix of angular : https://docs.angularjs.org/api/ng/provider/$locationProvider – Boris Charpentier Nov 17 '14 at 11:38
  • usually a better practice is to let server side codes decide about redirection to 404. anyway you need to use "data-href" instead of "href" for targeting elements or tabs. I think you're using JQuery approaches. have you read [this](http://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background?rq=1) ? – Reyraa Nov 17 '14 at 12:12
  • try this: http://stackoverflow.com/a/34340248/3008457 – ronald8192 Dec 17 '15 at 17:05

0 Answers0