Angular (1.6.x) routing into chrome to address location

170 views Asked by At

I'm trying to do a simple work in partial view by ng-view.It has four anchor link like sweden, denmark, norway... If I click one of them then it will show partial page on the index page.But it doesn't work.The browser address location shows something like

localhost/Angular%20js%20practice/#!#%2Fdenmark localhost/Angular%20js%20practice/#!#%2Fnorway

But it should be like --- localhost/Angular%20js%20practice/#/denmark--- and it will show me denmark partial page view. So what should I do?

myApp.config(function($routeProvider){
    $routeProvider
    .when('/sweden',{
        templateUrl:'templates/sweden.html',
        controller: 'myCtrl2'
    })
    .when('/norway',{
        templateUrl:'templates/norway.html',
        controller:'myCtrl2'
    })
    .when('/denmark',{
        templateUrl:'templates/denmark.html',
        controller:'myCtrl2'
    })
    .when('/turkey',{
        templateUrl:'templates/turkey.html',
        controller:'myCtrl2'
    });

});
    <ul>
        <li><a href="#/sweden">Sweden</a></li>
        <li><a href="#/norway">Norway</a></li>
        <li><a href="#/denmark">Denmark</a></li>
        <li><a href="#/turkey">Turkey</a></li>
    </ul>
<div ng-view></div>
0

There are 0 answers