No provider for Router?
Please use this module
RouterModule.forRoot(
[
{ path: "", component: LoginComponent}
]
)
now just replace your <login></login>
with <router-outlet></router-outlet>
thats it
I have also received this error when developing automatic tests for components. In this context the following import should be done:
import { RouterTestingModule } from "@angular/router/testing";
const testBedConfiguration = {
imports: [SharedModule,
BrowserAnimationsModule,
RouterTestingModule.withRoutes([]),
],