javascript - Turn off URL manipulation in AngularJS -
i'm trying write first web-app angular.
in normal mode (html5mode off), angular forces address's hash part "path" (adding leading "/"), , encodes special characters - example, allows single "?" , "#" in hash , replaces others %3f , %23.
is there way turn feature off? don't want use $locationprovider / $routeprovider features - want parse hash myself (in case, user's enter "free text" in hash search inside website).
i read routeprovider cannot configured use regular expressions...
if htmlmode turned on, address's hash part not forced path (no leading "/"), still encodes special characters.
i'm aware browsers might encode/escape special characters anyway, if user managed enter special characters in address bar don't want change it.
thanks
not sure of side effects of this, gets job done. note disable location manipulation angular app, if intended.
angular.module('sample', []) .config( ['$provide', function ($provide){ $provide.decorator('$browser', ['$delegate', function ($delegate) { $delegate.onurlchange = function () {}; $delegate.url = function () { return ""}; return $delegate; }]); }]);
tested in chrome 30, ie9, ie10.
inspired https://stackoverflow.com/a/16678065/369724
Comments
Post a Comment