AngularJS dependency injection

AngularJS Scopes

AngularJS dependency injection is a software design pattern in which components are given their dependencies rather than hard coding within component i.e. for reusing, maintainable and testable.

Following core components are injected into other as dependencies:

value: This is a javaScript object used to pass values to controller during config phase.

factory: This is used to return value after calculation.

service: This is used to perform certain tasks.

provider: This is used to create services, factory etc.

constant: This is used to pass values at config stage as we need to consider that no value will be used to be passed.

Leave a Reply

Your email address will not be published. Required fields are marked *