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:

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


Source code available here:


  1. Man. Thank you. This was making me crazy. So many tutorials and stuff ignore the .spec files. This finally resolved my issue.