No provider for Router?

后端 未结 8 941
情书的邮戳
情书的邮戳 2020-12-01 08:57

Im getting this error:

EXCEPTION: Error in ./AppComponent class AppComponent - inline template:0:0 caused by: No provider for Router!

相关标签:
8条回答
  • 2020-12-01 09:33

    I had a routerLink="." attribute at one of my HTML tags which caused that error

    0 讨论(0)
  • 2020-12-01 09:42

    Please use this module

    RouterModule.forRoot(
      [
        { path: "", component: LoginComponent}
      ]
    )
    

    now just replace your <login></login> with <router-outlet></router-outlet> thats it

    0 讨论(0)
提交回复
热议问题