Angular2 router (@angular/router), how to set default route?

后端 未结 10 1996
广开言路
广开言路 2020-12-02 15:07

How can I set a default route in my @Routes route metadata collection? If you use the angular2 router from @angular/router-deprecated you define the routes in @routeConfig

10条回答
  •  执笔经年
    2020-12-02 15:50

    You set path of route is ''. Example for DashboardComponent is load first.

    @Routes([
            { path: '', component: DashboardComponent },
            { path: '/ConfigManager', component: ConfigManagerComponent },
            { path: '/Merge', component: MergeComponent },
            { path: '/ApplicationManagement', component: ApplicationMgmtComponent }
    ])
    

    Hope it help you.

提交回复
热议问题