Why is the function in angular's DI inline annotation a array element?

前端 未结 2 864
生来不讨喜
生来不讨喜 2021-01-17 19:26

I have a question for the angularjs folks here.

So, I am using angular for quite a while now. However, every time when I am writing a new Controller or something th

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-17 19:58

    You don't have to use the syntax with an array anymore. You can write your code like this:

    module.directive('myDirective', function () {
        return {
            controller: function ($scope, $element) {
                // ...
            }
        }
    });
    

    Read more here

提交回复
热议问题