title: Reverse Engineering AngularJS dependency Injection
body: <p>I have learned in past about AngularJS dependency injection and it does it by calling the toString on the controller and then parsing the arguments and then calling the function with dependent arguments i.e $scope, $http, $location and so on..</p>
  
  <p>I've searched for the implementation of this and didnot find any understandable or actual smaller implementation to this.</p>
  
  <p>So if someone can explain this using a very simple implementation(pure JS) that would be helpful for all </p>
  
  <p><code>
  app.controller("MainCtrl", function($scope) {
  //Here the $scope is dependency injected and would'nt work if some another variable name was used.
  });
  </code></p>