Can't bind to 'routerLink' since it isn't a known property

后端 未结 9 876
别那么骄傲
别那么骄傲 2020-12-12 14:16

Recently, I have started playing with angular 2. It\'s awesome so far. So, i have started a demo personal project for the sake of learning using angular-cli. <

9条回答
  •  不思量自难忘°
    2020-12-12 14:50

    In my case I just need to import my newly created component to RouterModule

    {path: 'newPath', component: newComponent}
    

    Then in your app.module import the router and configure the routes:

    import { RouterModule } from '@angular/router';

    imports: [
            RouterModule.forRoot([
                {path: '', component: DashboardComponent},
                {path: 'dashboard', component: DashboardComponent},
                {path: 'newPath', component: newComponent}
            ])
        ],
    

    Hope this helps to some one !!!

提交回复
热议问题