Friday 15 January 2010

testing - How do you test dependency injection in angular? -


If I use type-scripts and angle I have notation for example in controller

a )

  Export Function Controller ($ Scope: Area) {} (& lt; Any; Controller) $ Inject = ['$ scope'];   

b) Restrict : 'E', etc. ... Controller: & lt; Any [] & gt; ['$ Scope', SomeCoolDirective.Controller], etc ...};

});

c)

  App.directive ('Some Guidelines', & lt; Any [] & gt; [' $ parse ',' $ rootScope ',' $ Compile ',' User Promotion ', function ($ parse, $ rootScope, $ compile, userPermissions) {}   

d)

  Services. .   

As you are seeing, there are different ways to specify dependencies for DI. But we are only human, I forget (controller). $ Injection, or I add some dependency and forgot to add to the array if I do not specify it, then it works, as long as up to the commute. There is a pain in the neck to find it. Sometimes there is no error in the browser console.

Do you know some tools that checks all the administrators, services, instructions and confirms that the right $ inject ['$ scope', ... etc] notation? Does it match all the necessary dependencies? I want to automate on the out-out server.

Why are not you the TypeScript compiler and what do you do it? Then publish it somewhere else (like Gitanbu) so that it can be used for poor people like me;)

No comments:

Post a Comment