簡體   English   中英

AngularJS依賴要求的差異

[英]AngularJS difference in dependency requirement

嗨,我正在學習AngularJS,我想知道定義依賴項的區別是什么:

angular.module('app.controllers')
.controller('myController', ['$scope', function ($scope) {
    // stuff
}]);

VS:

angular.module('app.controllers')
.controller('myController', function ($scope) {
    // stuff
});

只是想知道有什么不同:)

唯一的區別是,如果你縮小你的JavaScript,第二個選項將會中斷。

根據Maxim Shoustin和Chandermani的建議,這里有一些更詳細的信息:

http://thegreenpizza.github.io/2013/05/25/building-minification-safe-angular.js-applications/ https://docs.angularjs.org/guide/di

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM