I am learning AngularJS DI concept, Can anyone tell me why below code not working?
<script type="text/javascript">
var myApp = angular.module('myApp',[])
var myController = myApp.controller('MyController', function(a){
a.name = 'william'
console.log(a.name)
})
myController.$inject = ['$scope']
</script>
Iam getting an error as: https://docs.angularjs.org/error/$injector/unpr?p0=aProvider%20%3C-%20a
In above code, in place of 'a', if replaced with '$scope', it definitely works. As far as I understand, angular should inject $scope into 'a' parameter, right?