AngularJS Interview Questions

21. What is routing and how to implement routing in AngularJS
Routing is a core feature in AngularJS. This feature is useful in building SPA (Single Page Application) with multiple views. In single-page application, all views are different Html files and we use Routing to load different parts of the application and its helpful to divide the application logically and make it manageable. In other words, Routing helps us to divide our application in logical views and bind them with different controllers.

22. List Binding Directives in AngularJs
ng-bind
ng-bind-html
ng-bind-template
ng-non-bindable
ng-model

23. Explain digest cycle in AngularJS?
It’s the $digest cycle where the watchers are fired. When a watcher is fired, AngularJS evaluates the scope model, and if it has changed then the corresponding listener function is called. So, our next question is when and how this $digest cycle starts. The digest cycle is triggered automatically. We can also use $apply() if we want to trigger the digest cycle manually.

24. What is provider?
provider is used by AngularJS internally to create services, factory etc. during config phase(phase during which AngularJS bootstraps itself). Below mention script can be used to create MathService that we have created earlier. Provider is a special factory method with a method get() which is used to return the value/service/factory.

COPY CODE SNIPPET