1. What are the concept of scope hierarchy? Tell me how many scope can an application have?

Each angular application consist of one root scope but may have several child scopes. As child controllers and some directives create new child scopes, application can have multiple scopes. When new scopes are formed or created they are added as a children of their parent scope. Similar to DOM, they also creates a hierarchical structure.

2. Can you please explain the difference between angular.js and backbone.js?

Angular.js combines the functionalities of most of the 3rd party libraries, it supports individual functionalities required to develop HTML5 Apps. While Backbone.js do their jobs individually.

3. What are the advantages of using Angular.js framework?

Advantages of using Angular.js as framework are:

► Supports two way data-binding
► Supports MVC pattern
► Support static template and angular template
► Can add custom directive
► Supports REST full services
► Supports form validations
► Support both client and server communication
► Support dependency injection
► Applying Animations
► Event Handlers

4. How an object or function can get a hold of its dependencies?

These are the ways that object uses to hold of its dependencies

► Typically using the new operator, dependency can be created.
► By referring to a global variable, dependency can be looked up.
► Dependency can be passed into where it is required.

5. What is dependency injection in AngularJS?

DI or Dependency Injection is a software design pattern that deals with how code gets hold of its dependencies. In order to retrieve elements of the application which is required to be configured when module gets loaded , the operation "config" uses dependency injection.

6. What are the characteristics of "Scope"?

► To observer model mutations scopes provide APIs ($watch).
► To propagate any model changes through the system into the view from outside of the Angular realm.
► A scope inherits properties from its parent scope, while providing access to shared model properties, scopes can be nested to isolate application components.
► Scope provides context against which expressions are evaluated.

7. What are the styling form that ngModel adds to CSS classes?

ngModel adds these CSS classes to allow styling of form as well as control:

► ng- valid
► ng- invalid
► ng-pristine
► ng-dirty

8. What is factory method in angular.js?

For creating the directive, factory method is used. It is invoked only once, when compiler matches the directive for the first time. By using $injector.invoke the factory method is invoked.

9. What is Link function in AngularJS?

It is used for registering DOM listeners as well as instance DOM manipulation. It is executed once the template has been cloned.

10. What is Compile function in AngularJS?

It is used for template DOM Manipulation and collect all of the directives.

Download Interview PDF