Computer Science


Difference between dependency injection between array and without array angular

1 Answer

  • Reading angular docs on dependency injection, there are two minification-friendly methods to do this:

    Inline Array Annotation:


    The $inject property:

    function MyStuff(dep) {...}

    MyStuff.$inject = ['dependency'];


    The inline one (first) is recommended. In one of my projects the style guide insists on the use of $inject property. I also see $inject property form quite often in open source code.

You May Be Interested