Posted On: Feb 22, 2018
Dependency Injection or DI, is a design pattern of injecting objects into the angular components instead of angular components creating for themselves. The advantage of this is, we can separate our web application in multiple logical units, we can reuse these multiple logical units anywhere in our application. In angular dependency injection is the main concept without which angular does not work. For example, In order to use services(built-in or custom or both) we have to inject these services in our controller as shown below.
angular.controller('myCntrl',function($scope,$http)
{
//Use your $http service here
});
Never Miss an Articles from us.
AngularJS is a javascript framework which helps in developing web applications in MVC architectural pattern & SPA or..
Angular directives are the attributes which are decorated on the html tags or elements of an html page. Directives have ..
Angular provides the ability to create our own directives to implement our own custom templates or logic in our web appl..