There is a lot of variability in what Google pulls up and none of it seems to distill the basics very well.
Can someone provide a "hello world" example of JavaScript dependency injection.
I've used DI in PHP but with out the simple class-object paradigm, I'm finding it difficult to get a grasp of how this would function in JavaScript.
A hello world example of the method angular.js uses would be best, and why it uses toString() if it is not too complex would help.
Thanks
I found this blog entry to be helpful when looking at DI with JavaScript: http://merrickchristensen.com/articles/javascript-dependency-injection.html
Below is a simple example of using angular.js for dependency injection:
function HelloWorld($scope){
$scope.name="ajay";
}
HelloWorld.$inject = ['$scope'];