Angularjs is Urlencoding forward slashes after second hash /#/# even though no routeprovider is used

665 views Asked by At

I'm running angular 1.3.11 and including an application that injects an url for deeplinking as such /#/#/pagename/itemid

Problem is, as soon as the location is changed, it seems angular overwrites the url, urlencoding slashes after the second hash as such /#/#%2Fpagename%2Fitemid

Is there a way to configure angular to not rewrite urls? I'm not using an angular routeprovider anywhere on these particular pages so I don't see why it needs to touch the url at all.

The deeplink url is provided by the underlying application and not something I can control. The angular implementation is on my end though. I've searched the angular documentation, google and StackOverflow and haven't found a solution to a similar issue.

Of course I could try to urldecode it before sending it back to the application, but I'd prefer that angular just let my url:s be until I ask it to.

1

There are 1 answers

0
Jan On BEST ANSWER

Found the answer at Turn off URL manipulation in AngularJS . The same solution as suggested there worked for me:

angular.module('sample', [])
    .config( ['$provide', function ($provide){
        $provide.decorator('$browser', ['$delegate', function ($delegate) {
            $delegate.onUrlChange = function () {};
            $delegate.url = function () { return ""};
            return $delegate;
        }]);
    }]);