dpjayasekara
2/22/2016 - 9:12 AM

Using $inject to inject dependencies in AngularJS

Using $inject to inject dependencies in AngularJS

angular.module('app')
  .controller('MyController', MyController);
  
MyController.$inject = ['$scope', '$http', '$location'];

function MyController ($scope, $http, $location) {
  // write controller function
}