通過文檔閱讀,並與玩的jsfiddle,我注意到在以下幾個方面*被定義控制器(和工作):定義基本AngularJS控制器與服務
function InvoiceCntl($scope) {...}
function Ctrl2($scope, $timeout) {...}
function countController1($scope, $http, $timeout) {...}
function countController2($scope, $timeout, $http) {...}
我的問題是有關的部分調用我的控制器的AngularJS庫:它如何知道我期望的服務以及我的控制器期望它們的順序?
這是JavaScript,Jim,但不是我們所知道的。
*bearing in mind that controllers shouldn't be defined in the global scope
謝謝。我跟着你的鏈接,然後一個更多,最終結束了_ [這裏](https://github.com/angular/angular.js/blob/master/src/auto/injector.js)_,在那裏我發現了魔法。它將該函數轉換爲一個字符串,然後將這些參數重新格式化。 – aidan