Monday, 3 April 2017

How to fix 'router-outlet' is not a known element

When adding routing to an AngularCLI project you need to also update the startup test with the RouterTestingModule.

Failure to do so results in the following error when running ng test:

Failed: Template parse errors:
'router-outlet' is not a known element:
1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas'

Here is the fix (click on the image to enlarge): 

image

Source code available here:

https://github.com/stevenh77/angular-lob-app/commit/f582ecf5034af3222a686ae0e9f237f6528aefa6

No comments:

Post a Comment