Any way to disable routing - problems using traditional named anchor locations like <a href="#info">...

1,259 views
Skip to first unread message

Rob Bygrave

unread,
Nov 8, 2012, 8:34:10 PM11/8/12
to ang...@googlegroups.com
Hi,

I have been trying to use Angular with an existing application. That application makes use of named anchors to scroll the user to that anchor in the page.

I couldn't find a way to disable the routing effectively.

If I used $locationProvider.html5Mode(true); I had some bad side effects for the rest of my application on that page.  When I used $locationProvider.html5Mode(false); .... then angular automatically modified the url in the browser prefixing a / e.g "#info" became "#/info" ... and events fired on '$locationChangeStart occured after that so event.preventDefault(); did not work out.

Is there a way of using traditional named anchors on a page with Angular?


Thanks, Rob.

Peter Bacon Darwin

unread,
Nov 9, 2012, 2:29:17 AM11/9/12
to ang...@googlegroups.com
The AngularJS Docs are an AngularJS app using HTML5 mode and hashes: Here is an example[sic]: http://docs.angularjs.org/api/ng.directive:ngBind#Example
Pete

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en.
 
 

Rob Bygrave

unread,
Nov 11, 2012, 4:42:25 PM11/11/12
to ang...@googlegroups.com

Thanks. 

Yes, I tried html5 mode and weird stuff started happening with the rest the application - it starting interferring with the location/url of the non-angular ajax/jquery posts which I didn't have time to look into.

Hampus Ahlgren

unread,
May 24, 2013, 8:07:33 AM5/24/13
to ang...@googlegroups.com
Hi Rob, did you manage to solve this problem?

Rob Bygrave

unread,
May 27, 2013, 11:57:37 PM5/27/13
to ang...@googlegroups.com
As a workaround I ended up using javascript element.scrollIntoView().  So on read a specific url query parameter and based on that used scrollIntoView() - which was ok.

Cheers, Rob.

You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/l4tysVjXiHo/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages