http://www.alexrothenberg.com/2013/02/11/the-magic-behind-angularjs-dependency-injection.htmlを読ん でいますが、javascript を縮小すると angularjs の依存性注入に問題があることが判明したので、代わりに
var MyController = function($scope, $http) {
$http.get('https://api.github.com/repos/angular/angular.js/commits')
.then(function(response) {
$scope.commits = response.data
})
}
あなたが使用する必要があります
var MyController = ['$scope', '$http', function($scope, $http) {
$http.get('https://api.github.com/repos/angular/angular.js/commits')
.then(function(response) {
$scope.commits = response.data
})
}]
全体として、2番目のスニペットは古いバージョンのangularjs用だと思っていましたが....
常に注入方法 (2 つ目) を使用する必要がありますか?