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 ?
Router-Outlet is an Angular directive from the router library that is used to insert the component matched by routes to be displayed on the screen.
RouterOutletlink Acts as a placeholder that Angular dynamically fills based on the current router state.
The router-outlet is a directive that's available from the @angular/router package and is used by the router to mark where in a template, a matched component should be inserted. Thanks to the router outlet, your app will have multiple views/pages and the app template acts like a shell of your application.
Angular Router supports multiple outlets in the same application. A component has one associated primary route and can have auxiliary routes. Auxiliary routes enable developers to navigate multiple routes at the same time.
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 ]
});
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With