跳转到内容
angular challenges logo Angular Challenges

🟠 Change Detection Bug

挑战 #32

此内容尚不支持你的语言。

创建者 Thomas Laforge

Information

In this small application, we have a navigation menu to route our application to either BarComponent or FooComponent. However, our application is not loading and no errors are displayed inside the console.

Statement

The goal of the challenge is to debug this application and make it work.

Hints

Hint 1

If you comment out routerLinkActive="isSelected" inside NavigationComponent, the application loads correctly.

Hint 2

If you open the RouterLinkActive source code and go to line 196, Angular is calling this.cdr.markForCheck inside a microTask, which triggers a new CD cycle. If you comment out this line, the application loads again, however, the bug should not be fixed by changing the Angular source code. 😅😯

贡献者

感谢所有帮助本文档变得更好的贡献者!

  • tomalaforge
  • tomer953
  • jdegand
  • LMFinney