I've just created a new angular project using the Angular CLI and scaffolded a new route and I am getting error as :
'router-outlet' is not a known element
Can anyone help me ?
I've just created a new angular project using the Angular CLI and scaffolded a new route and I am getting error as :
'router-outlet' is not a known element
Can anyone help me ?
Here is the solution that worked for me, inspired by gaurav2887 from this page:
import { RouterTestingModule } from '@angular/router/testing';
...
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ MyComponent ],
imports: [ RouterTestingModule ]
});
...
You need to first import Routes & RouterModule
import { Routes, RouterModule } from '@angular/router';
Then import it with root Constant and Export
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
Then Export all the Components you want to implement routing with.
That set...Hope it will work.
The following worked!
Using:
"@angular/router": "3.1.2",