该bug会导致<router-outlet>嵌套<router-outlet>时会出现显示错误。
A component throws a runtime error when the model and the template are not compatible. For example:
{{foo[barr]}}
and the foo is undefined. This is handled by Angular and it doesn't break the application.
Unfortunately, this is not the case when the BrowserAnimationsModule is provided. Angular is not able to remove old html elements anymore. The router-outlet keeps the old pages and the stack grows as I navigate. The same is true for *ngIf.
解决方法:
1、升级Angular到5.1.3
2、不引入BrowserAnimationsModule
改bug曾出现在angular2版本中,解决方法是不引入BrowserAnimationsModule。
参考资料:
https://github.com/angular/angular/issues/19093