angularjs - angular rewrite url in html5 mode -
now work in case write chrome extension in gmail, , our extension use ui-router change view, change url xxx/#inbox xxx/#/inbox, block extension features(streak) while customer expect use in same time. enable html5 mode, , rewrite url make work. here rewrite part:
app.config(function($provide,$locationprovider,....){ $provide.decorator('$browser', function($delegate) { var superurl = $delegate.url; $delegate.url = function(url, replace) { if(url !== undefined) { return superurl(url.replace(/\%2f/g,"/"), replace); } else { return superurl().replace(/\//, "%2f"); } } return $delegate; }); $locationprovider.html5mode({ enabled: true, requirebase: false, rewritelinks: true }); ...... })
it works fine our part extension, while click streak feature, cause error
lib.js:17317 uncaught error: [$rootscope:infdig] [http://errors.angularjs.org/1.5.3/$rootscope/infdig?p0=10&p1=%5b%5d]error-link
like infinite $digest loop suggestion fix this?
Comments
Post a Comment