Demo

Dependency Injection

We don’t have to worry about the dependencies to load, just declare them as dependencies and angular will take care of the rest.

It greatly makes the application readable, scalable and testable. While testing you can easily pass the dependencies.

Dependency Injection is a pattern which is mostly used in components to resolve their dependencies. Instead of direct instantiation, every component will receive references to required other components like services, utilities etc. as parameters to their constructor.

Great Testing support – Unit and E2E

Believe me, AngularJS makes testing the application very simple. If you write the test cases for jQuery/Backbone, it would be neither straightforward nor simple and we have to use multiple libraries.

With Angular, testing the application is a piece of cake. Angular Provides two types of testing

1) Unit Testing

Using unit tests, we test individual pieces of code and make sure our code behaves the same in different scenarios. Angular provides the way to test Controllers, Services, Directives etc.
Angular Even provides mocking library so that we can easily mock the dependencies.

2) E2E Testing

Let’s look at the real-time use case, where we need E2E tests. Whenever some permission changes from the Database, the Unit test will not fail, whereas the DOM/E2E test will fail and make sure we don’t accidentally give the broken application to the client/user.