javascript - Angular $locationProvider html5Mode / <base> error -
so i'm running problem angular 1.3.15 , $locationprovider. every time turn html5mode on typeerror: cannot read property 'replace' of undefined
error. if leave html5mode off, works fine.
my directory structure (4.dev being versioned directory name):
public / - index.html 4.dev / css / js / images / partials / etc...
i have base tag set this:
<base href="/4.dev/">
and i'm configuring $locationprovider so:
$locationprovider.html5mode({ enabled: true });
if change base tag href "/"
angular doesn't have issues (but assets don't load). suspect issue angular having deals fact index.html file 1 directory rest of site.
for reasons won't list here, can't change dir structure , don't want change base tag (because don't want manually stick version number these files). want leave html5mode on.
does have solution problem? there way me manually set "base href" angular, leave tag alone static assets?
so, looks angular's inner workings tightly coupled href of tag results in major issues if have directory structure that's bit unconventional mine.
stumbled across github thread people asking feature change , @greglockwood posted fix.
with fix, tag can work static assets while provide own set "basehref" angular's stuff.
worked charm me! hope helps stumbles across this!
Comments
Post a Comment