Angularjs minify best practice

前端 未结 7 1512
孤独总比滥情好
孤独总比滥情好 2020-11-22 03:12

I\'m reading http://www.alexrothenberg.com/2013/02/11/the-magic-behind-angularjs-dependency-injection.html and it turned out that angularjs dependency injection has problem

7条回答
  •  自闭症患者
    2020-11-22 03:44

    You might want to use $inject as it mentioned here:

    MyController.$inject = ['$scope', '$http'];
    
    function MyController($scope, $http) {
      $http.get('https://api.github.com/repos/angular/angular.js/commits')
        .then(function(response) {
          $scope.commits = response.data
        })
    }
    

提交回复
热议问题