Register Login

Top AngularJS Interview Questions and Answers

Updated Jul 04, 2019

1. What is AngularJs?

AngularJS is a JavaScript-based development framework that is useful for building high performance and large-scale web applications in a manner that they can be easily maintained. It is used for building RICH Internet Application (RIA) and writing client-side applications in a clean MVC with the help of JavaScript. It is completely free, open-source and licensed under Apache License version 2.0.

2. What are services in Angular JS?

AngularJS features built-in services like $https that are used for making XMLHttpRequests (Ajax calls). These services are in the form of singleton objects that can be instantiated only once in any app.

3. What is factory method in AngularJS?

In AngularJS, reusable singleton objects called services are used for organizing and sharing codes across applications. These services can be incorporated into filters, directives, controllers, etc. When a service is created in Angulajs, then either a factory, provider or service have to be defined before anything can be assigned to the same.

4. What is provider () in AngularJS?

The provider ( ) is used for the creation of factory, services, etc. (internally) in AngularJS during the config phase. The config phase is the stage when AngularJS is bootstrapping itself. It is a specially designed factory method with a method get() that’s used for returning the factory/ value/service.

5. What is controller in AngularJS?

A Controller in AngularJS is a JavaScript function that is bound to any specific scope. It is a prime actor in AngularJS framework that carries out functions that operates on data. It is also responsible for deciding upon the view that has to be updated in the model-based data.

6. What is dependency injection in AngularJS?

AngularJS features a Dependency Injection mechanism with value, factory, service, provider and constant as the core components that are capable of being injected into one another as dependencies.

7. What is a directive in AngularJS?

A directive in AngularJS is a marker on DOM elements. The DOM elements are elements, CSS, attributes, etc. Directives are useful for creating custom HTML tags that can be used as custom, new widgets. 

8. What is Protractor in AngularJS?

Protractor, known as E2E testing framework formerly, is a functional, open source automation framework. It was specifically designed for the purpose of AngularJS web applications to replace the existing E2E testing frameworks.

9. What are filters in AngularJS?

Filters are used for selecting a subset of items and returning a new array from any given array. They are used for showing filtered items belonging to a list of items on the basis of any given defined criteria.

10. What is routing in AngularJS?

Routing is a concept related to switching views. The AngularJS based controller is responsible for deciding which view has to be rendered on the basis of business logic.

11. What is data binding in AngularJS?

Data-binding in terms of AngularJS applications is the synchronization of data in between the view and model components.

12. What is $scope in AngularJS?

$scope is typically a JavaScript object. It binds the view and the controller objects. Users can define the member variables of the scope from the controller and the same can be accessed via the view object. 

13. What is directive in AngularJS?

A directive in AngularJS is a marker linked with DOM elements - of the likes of elements, CSS, attributes, etc. It is used for the creation of custom HTML tags which can work as custom, new widgets. 

14. What is DOM in AngularJS?

In AngularJS, directives are put to use to bind the application data to HTML DOM elements. DOM means Document Object Model in AngularJS.
15. What is AngularJS digest cycle?

AngularJS digest cycle forms the backbone process for AngularJS data binding. This process can be initiated by creating a function call like $scope.$apply() for kicking off a digest cycle.

16. What is deep linking in AngularJS?

Deep linking helps in encoding the application state in the URL with the purpose of getting it bookmarked. Thereafter, it will become possible for the application to be restored to the same state from the URL.

17. What is SPA in AngularJS?

SPA or single-page application (SPA) in AngularJS refers to a website or web application that is capable of interacting with users. All kinds of codes (JS, HTML, CSS) can be retrieved through a single page load with SPA. It does so by dynamically rewriting current pages rather than loading new pages entirely from the server. 

18. How to debug AngularJS in chrome?

Google Chrome offers a debugger tool for creating a breakpoint in the AngularJS code. The statement given for debugging purposes freezes the browser during execution so that the running code may be examined from within the actual application. This debugging process is carried out at the point of execution within the browser

19. What is ng-app in AngularJS?

The ng-app directive informs AngularJS about the root element of the application. By default, all AngularJS applications possess a root element. Just one ng-app directive can be contained in a given HTML document.

20. Explain ng-model directive?

The ng-model directive is used for binding the data values applicable to the AngularJS application to specific HTML input controls. The ng-model is capable of creating a model variable that is linked to the HTML page and is within the container control object that has the ng-app directive.


×