javascript - Angular JS links in hash mode not behaving right -
having issues links in page in angular application.
so quick overview :
i have html 5 mode turned off
here routing set up
$routeprovider .when('/',{ templateurl: '/views/search.html', controller : 'searchctrl' }) .when('/result',{ templateurl: '/views/result.html', controller : 'resultctrl' }) .when('/no-result',{ templateurl: '/views/no-result.html', controller : 'noresultctrl' }) .otherwise({ redirectto: '/' });
$locationprovider.html5mode(false);
the issue found behaviour of url
- if type in domain, page loads fine following url
domain/# , view loads correctly , loads controller well
- but lets have a href in page want link homepage
as follows
<a ng-href="/" class="link-dark">link </a>
it changes url domain/# view , controller not load.
but if change url
<a ng-href="/#/" class="link-dark">link </a>
it loads correctly.
is normal behaviour seems off ?
this normal behavior. if use angular ui-router can use state without having use # signs.
Comments
Post a Comment