Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Potential bug in registerComponent #14391
Bug exists on angular 1.5.3 and even on master branch.
In compile.js at the beginning of registerComponent (angular.component) method there is a assignment:
Some lines later (after factory function definition) the
This may modify an angular method
How I found it?
I came across this problem using ngComponentRouter 2.0.0 with Angular 1.5.3 when I had two components without controllers defined. In this situation when factory function is executed, the default controller (noop) has $routeConfig property from the later one defined component (because registerComponent modify the same object:
Probably the fix is fairly simple. Use
This will guarantee new function object at any situation.