Hello all,

I'm attempting to distinguish links which should be handled using
Angular's HTML5 routing from those which point to separate pages that
should be handled by conventional navigation.  Ideally, I'd like to do
this without resorting to tagging every conventional link with
target="_self".  For purposes of discussion, I have an Angular
application at /app and all URLs starting with /app/ are handled by
HTML5 routing, all other URLs are separate pages.

My reading of the "Html link rewriting" section of the Developer
Guide[1] and issue #3520[2] suggests that this can be done by adding
<base href="."> and prefixing URLs with "./".  However, I have been
unable to get this to work.

I've created a Plunk to demonstrate the issue.[3]  My expectation is
that "App Page 2" and "App Page 3" would both result in HTML5
navigation while all other links would result in conventional
navigation (which would cause a 404 on plnkr.co).  However, it appears
that all links cause HTML5 navigation with the exception of "App Page
3" which causes an error because of how the base URL is prepended to
the path, which results in a link to a different domain.

My questions to you are:  Is my understanding correct?  Is the current
Angular behavior (or documentation) buggy?  From the code, it looks
like any relative URL as <base> will be misinterpreted since it is
appended to the domain root URL without a slash.[4]  Is there another
way to achieve the desired behavior without tagging all off-page links
with target="_self"?

Thanks,
Kevin

1.  https://docs.angularjs.org/guide/$location#html-link-rewriting
2.  https://github.com/angular/angular.js/pull/3520
3.  http://plnkr.co/edit/0OflC6ZDttYeYLJzlMel
4.  
https://github.com/angular/angular.js/blob/v1.3.0-beta.18/src/ng/location.js#L629

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to