angularjs - refresh when clicked on link with actual url

后端 未结 10 1299
深忆病人
深忆病人 2020-12-02 10:13

I use routeProvider to define controlers and templates for my urls.

When I click on the link, which has the same url as is the actual location, nothing happens. I w

10条回答
  •  一个人的身影
    2020-12-02 10:31

    I ran into this issue a moment ago, except for it was the home page '/'. I wanted a simple solution with less code. I just took advantage of the .otherwise method in the $routProvider

    So in the html link looks like:

    Home
    

    since there is no '/home' page specified in the routProvider it will redirect to '/' via the 'otherwise' method. page with this set up:

    .otherwise({
    redirectTo: '/'
    });
    

    Hope it helps someone

提交回复
热议问题