AngularJS routing without the hash '#'

前端 未结 10 778
野性不改
野性不改 2020-11-22 01:40

I\'m learning AngularJS and there\'s one thing that really annoys me.

I use $routeProvider to declare routing rules for my application:

         


        
10条回答
  •  -上瘾入骨i
    2020-11-22 02:19

    You could also use the below code to redirect to the main page (home):

    { path: '', redirectTo: 'home', pathMatch: 'full'}
    

    After specifying your redirect as above, you can redirect the other pages, for example:

    { path: 'add-new-registration', component: AddNewRegistrationComponent},
    { path: 'view-registration', component: ViewRegistrationComponent},
    { path: 'home', component: HomeComponent}
    

提交回复
热议问题