1

Have generate my route in my app:

app.config( function($routeProvider){
    $routeProvider
        .when('/',{
            templateUrl: './partials/home/home.html',
            controller: 'mainCtrl'}
        )
        .when('/article',{
            templateUrl: './partials/article/article.html',
            controller: 'articleCtrl'}
        )
        .otherwise({
            redirectTo: '/'
    });

});

It's working !

But link was bas :( I create my link like that :

<div class="read-more"><a href="#article">Lire plus...</a></div>

my bad link: http://localhost:10001/#!/#article

vs the good link was : http://localhost:10001/#!/article

Who was wrong ?

thx

PS I use node lite-server

Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
darkiron
  • 1,174
  • 1
  • 10
  • 20

1 Answers1

2

This http://localhost:10001/#!/article is the right url.

The reason being, if the browser is HTML5 browser AngularJS will redirect it to #!

Otherwise it will be only #.

Read this documentation here on $location to find out more on why this happens.

  • Opening a regular URL in a legacy browser -> redirects to a hashbang URL
  • Opening hashbang URL in a modern browser -> rewrites to a regular URL
Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108