Saturday, 29 August 2015

60 [UPDATED] ANGULAR JS Interview Questions and Answers pdf

ANGULAR JS Interview Questions and Answers pdf :-


1. What is AngularJS?

2. Is AngularJS a library, framework, plugin or a browser extension?

3. What are the key features of Angular.js ?

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

5. What is scope in Angular.js?

6. What is ng-app and ng-init in AngularJS?

7. What is services in Angular.js ?

8. What is controller in AngularJS?

9. What is the bootstrapping in AngularJS?

10. Does Angular use the jQuery library?
ANGULAR JS Interview Questions and Answers
ANGULAR JS Interview Questions and Answers

11. Is AngularJS same as jQuery?

12. What are directives in AngularJS?

13.what is directive and Mention what are the different types of Directive?

14. Explain what is data binding in Angular.js ?

15. What are factory method in angularJs?

16. Can angular applications (ng-app) be nested within each other?

17. What is testability like in Angular?

18. How to initiate variable in AngularJS?

19. What are templates in AngularJS?

20. What is MVC Architecture in AngularJS?

21. Explain what is Angular Expression? Explain what is key difference between angular expressions and JavaScript expressions?

22. What is ng-model in AngularJS?

23. what is injector?

24. What AngularJS routes does?

25. What is linking function?

26.What is Pre-linking function and Post-linking function in AngularJS?

27. Explain what is the difference between link and compile in angular.js?

28. What are the characteristics of "Scope"?

29.what is the difference between angular.js and backbone.js?

30.Explain the concept of scope hierarchy? How many scope can an application have?

Explain the concept of scope hierarchy? 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.

what is 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.

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.

Explain what is the difference between link and compile in angular.js?

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

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

What is Pre-linking function and Post-linking function in AngularJS?

Pre-linking function is executed before the child elements are linked. It is not considered as the safe way for DOM transformation.

Post linking function is executed after the child elements are linked. It is safe to do DOM transformation by post-linking function.

What is linking function?

Link combines the directives with a scope and produce a live view. For registering DOM listeners as well as updating the DOM, link function is responsible. After the template is cloned it is executed.

What AngularJS routes does?

AngularJS routes enable you to create different URLs for different content in your application. Different URLs for different content enables user to bookmark URLs to specific content. Each such bookmarkable URL in Angular.js is called a route.

A value in AngularJS is a simple object. It can be a number, string or JavaScript object. Values are typically used as configuration injected into factories, services or controllers. A value should be belong to an Angular.js module.

Injecting a value into an Angular.js controller function is done by adding a parameter with the same name as the value.

Explain what is injector?

An injector is a service locator. It is used to retrieve object instances as defined by provider, instantiate types, invoke methods and load modules. There is a single injector per Angular application, it helps to look up an object instance by its name.

What is ng-model in AngularJS?

To bind the html tags (input, select, textarea) to Angular Application Data

Explain what is Angular Expression? Explain what is key difference between angular expressions and JavaScript expressions?

Like JavaScript, Angular expressions are code snippets that are usually placed in binding such as {{ expression }}.

The key difference between the JavaScript expressions and Angular expressions:

Context : In Angular, the expressions are evaluated against a scope object, while the Javascript expressions are evaluated against the global window.

Forgiving: In Angular expression evaluation is forgiving to null and undefined, while in Javascript undefined properties generates TypeError or ReferenceError.

No Control Flow Statements: Loops, conditionals or exceptions cannot be used in an angular expression.

Filters: To format data before displaying it you can use filters.

What is MVC Architecture in AngularJS?

In AngularJS, scope objects are treated as Model. The View is display of model that is our data. And the model gets initialized within a JavaScript constructor function, called Controller in AngularJS.

What are templates in AngularJS?

In Angular, templates are written with HTML that contains Angular-specific elements and attributes. Angular combines the template with information from the model and controller to render the dynamic view that a user sees in the browser. In other words, if your HTML page is having some Angular specific elements/attributes it becomes a template in AngularJS.

How to initiate variable in AngularJS?

<div ng-app="" ng-init="quantity=10;cost=5">
             <b>Total Cost: {{ quantity * cost }}</b>
         </div>

What is testability like in Angular?

Very testable and designed this way from ground up. It has an integrated dependency injection framework, provides mocks for many heavy dependencies (server-side communication)

Can angular applications (ng-app) be nested within each other?

NO. AngularJS applications cannot be nested within each other.

What are factory method in angularJs?

Factory method are used to create the directive. It is invoked only once, when compiler matches the directive for the first time.
By using $injector.invoke the factory method is invoked.

Explain what is data binding in Angular.js ?

Automatic synchronization of data between the model and view components is referred as data binding in Angular.js.

There are two ways for data binding:

  1. Data mining in classical template systems
  2. Data binding in angular templates

what is directive and Mention what are the different types of Directive?

During compilation process when specific HTML constructs are encountered a behaviour or function is triggered, this function is referred as directive.  It is executed when the compiler encounters it in the DOM.

Different types of directives are :-

  1. Element directives
  2. Attribute directives
  3. CSS class directives
  4. Comment directives

What are directives in AngularJS?

Directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS to attach a specified behavior to that DOM element or even transform the DOM element and its children. When AngularJS finds the directive at the time of rendering then it attaches the requested behavior to the DOM element. Angular comes with a set of these directives built-in, like ngBind, ngModel, and ngClass.

Is AngularJS same as jQuery?

NO. jQuery is great library for manipulating the DOM, providing better user experience with animations and effects. You can create website using jQuery but not a web application. jQuery is just a library to play around with HTML, where as AngularJS is a framework to build a dynamic web app as it supports two data binding, MVC, allow testability, templates and many more. AngularJS is like a toolbox and jQuery is just a tool.

Does Angular use the jQuery library?

Yes, Angular can use jQuery if you have included the jQuery library.
If jQuery is not present in our script path, Angular falls back to its own implementation of the subset of jQuery that we call as jQLite.

What is the Bootstrapping in AngularJS?

Bootstrapping in AngularJS is nothing but just initializing, or starting, your Angular app. AngularJS supports automatic bootstrapping as well as manual way as well.

What is Controller in AngularJS?

Controller is constructor function in Angular Controller.
When a Controller is attached to the DOM with use the ng-controller, Angular will instantiate a new Controller object using constructor function.

What is services in Angular.js ?

In angular.js services are the singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on.

What is ng-app and ng-init in AngularJS?

ng-app is used to initialize the Angular Application.

ng-init is used to initialize the Angular Application data.

What is Scope in Angular.js?

Scope refers to the application model, it acts like glue between application controller and the view. Scopes are arranged in hierarchical structure and impersonate the DOM ( Document Object Model) structure of the application. It can watch expressions and propagate events.

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

What are the key features of Angular.js ?

The key features of angular.js are:

  1. Scope
  2. Model
  3. View
  4. Controller
  5. Services
  6. Data Binding
  7. Directives
  8. Filters
  9. Testable

Is AngularJS a library, framework, plugin or a browser extension?

AngularJS fits the definition of a framework the best, even though it's much more lightweight than a typical framework and that's why many confuse it with a library.

AngularJS is 100% JavaScript, 100% client-side and compatible with both desktop and mobile browsers. So it's definitely not a plugin or some other native browser extension.

What is AngularJS?

AngularJS is a javascript framework used for creating single web page applications. It allows you to use HTML as your template language and enables you to extend HTML’s syntax to express your application’s components clearly.