Angular 4 - Routes - How to create a separate module for managing routes and use it in app.module.ts file

前端 未结 2 1173
情深已故
情深已故 2021-01-14 18:21

I am newbie in Angular, I want to implement the routes in separate component and import the same component in app.module.ts file. How do I import t

2条回答
  •  温柔的废话
    2021-01-14 18:38

    AppRoutes is a class so you need to instanciate it before using it:

    let appRoutes = new AppRoutes(); 
    

    then

    ...
    RouterModule.forRoot(appRoutes.getRoutes()) 
    

提交回复
热议问题