close
  menu      DavidRodenas
CONTACT  

AngularJS $componentController implementation

The implementation of $componentController so it does not need to increase the size of angular.min.js library, but it allows to create tests of components.


it('should instantiate a controller of a component', inject(function($componentController) {
    var myController = $componentController('myComponent');
    expect(myController).toBeDefined();
}));

The final merge is here.

When I made this $componentController proposal my idea was to implement it without increasing the size of angular.min.js. @petebacondarwin was faster, in almost no time he liked the idea and implemented it. But, he also modified compile.js which resulted in a increase size of angular.min.js.

I get his code as reference, and I did a new implementation of $componentController, this time accessing just AngularJS metadata and removing all changes inside compile.js.

The result this PR and the current recommended way to test components supported by the official AngularJS guide.