angularjs - Construct an absolute URL without circumventing $location's abstraction -
in angularjs application utilize $location's html5-mode, handily includes fallback browsers not supporting html5 history api.
i need generate url pointing application , avoid hardwiring it. instead, leverage $location or underlying mechanisms.
example: need url have $location.path()
/my/subpath
. in browser html5-support url http://example.com/my/subpath
, in browser without http://example.com/#!/my/subpath
.
i tried find mechanism used anchor rewriting in angular sources not find it.
is planning possible or on wrong track?
you use
var path = window.location.hash.substr(1);
of course of study should check html 5 back upwards in browser before using either of apis
angularjs
No comments:
Post a Comment