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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -