Top 30 AngularJS Interview Questions and Answers for 2020

Facebooktwitterredditpinterestlinkedinmailby feather

Most Frequently asked AngularJS Interview Questions and Answers for Fresher

Top 30 Angular-js interview Questions for Fresher and Experienced

1) Describe Angular JS ?

It is a powerful framework of JavaScript. AngularJS is used to design Rich Internet Application. This framework is developed on MVC (Model View Controller) which provide full feature of SPA (Single Page Application) Framework.

2) Give advantages and disadvantages of AngularJS.

Advantages of AngularJS

  1. User can easily create Single page Application
  2. Rich and Responsive experienced to user.
  3. Form Validation is already present.
  4. It is an open source framework.
  5. AngularJS is Platform (Browser) Independent.
  6. It supports Routers and two-way binding.
  7. A code of AngularJS is Unit testable.

Disadvantages of AngularJS

  1. Security: It is not secure as build on JavaScript Framework.
  2. User Dependent: If user disables the JavaScript then AngularJS cannot run.

3) Is jQuery or AngularJS interdependent?

NO, they are not interdependent.

4) Different IDE’s that use AngularJS for development?

IDE’s are Eclipse, Web Storm, Visual Studio, Text Mate etc.

5) Enlist the Features of AngularJS.

Some AngularJS Features are as Follow:

  1. MVC
  2. Validations
  3. Modules
  4. Directives
  5. Templates
  6. Scope
  7. Expressions
  8. Data Binding
  9. Filters
  10. Services
  11. Routing
  12. Dependency Injection
  13. Testing

6) Define and Enlist Directives of AngularJS.

AngularJS has DOM element Directives which act as Markers. They attach a specific behaviour to that DOM element and can even transform the DOM element and its children.

Three main core directives are:

  • ng-app
  • ng-model
  • ng-bind

7) Define Controller in AngularJS?

In AngularJS to provide data and logic into HTML java script function is used which is known as Controller.

8) Give the use of controller.

  • Set up initial state of the $scope object
  • Add behaviour to the $scope object.

9) Define Data Binding in AngularJS?

Data binding is used to synchronize the view and model.

10) How are services used in AngularJS?

Services is a function or object that is used in AngularJS. Some of the inbuilt services are $location, $http etc. There are 30 built in services.

11) Define Scope in AngularJS?

Scope is the binding part between view(HTML) and controller(Java Script) through object. It has some properties and method which is available for both view and controller.

12) How to use template in AngularJS?

Template is used to obtain Dynamic view we uses template which consist of HTML+CSS+AngularJS Directives.

13) Write Expression in AngularJS?

It is similar to JavaScript Expression where it consists of literals, operators, and variables.

Eg. {{1+1}} or {{Country+””+State}}.

14) Describe Filter and its use.

Filter is used to transform data it can be embedded in expression or directive.

Eg. Currency, Uppercase, Lower case, Order by.

15) What is “$rootScope” in AngularJS?

$rootScopeData provides a seperation between View and its Model. It is the root directory all other scope is its child scope.

16) What is SPA in AngularJS?

SPA stands for Single Page Application which are web application. It loads a single HTML page and dynamically update that page as the user interacts with the app.

17) What is a Factory method in AngularJS?

Factory method is similar to the services. It is used to create new object and add functions as properties of this object and at the end we return this object.

18) What is REST in AngularJS?

REST stands for Representational State Transfer in AngularJS. It operates over HTTP requests over API. The requested URL identifies the data to be operated on, and the HTTP method identifies the operation that is to be performed.

19) What are the attributes can be used during creation of a new AngularJS Directives?

Following are the list of attributes:

  1. Restrict: This attribute consists of value “A” (directives to be triggered on the attribute name), “E” (only match element name), “C” (only match class name) and “M” (only match the comment name).
  2. TemplateUrl: The templateUrl attribute tells the AngularJS HTML compiler to replace custom directive inside a template with HTML content.
  3. Template: It specify an inline template as a string. Not used if you’re specifying your template as a URL.
  4. Replace: It has two values true or false. If true, replace the current element. If false or unspecified, append this directive to the current element.
  5. Transclude: It moves the original children of a directive to a location inside the new template.
  6. Scope: It create a new scope for this directive rather than inheriting the parent scope.
  7. Controller: It create a controller which publishes an API for communicating across directives.
  8. Require: It require that another directive be present for this directive to function correctly.
  9. Link: It modify resulting DOM element instances, add event listeners, and set up data binding.
  10. Compile: It modify the DOM template for features across copies of a directive, as when used in other directives.

20) What are the characterstics of Scope?

Data binding is used to synchronize the view and model.

  1. The $scope is the connection between the HTML and the View.
  2. $scope provides the execution context for the DOM and the expression
  3. $scope is modified when the View changes and the View is modified when $the scope changes its value.
  4. The $rootScope is the parent of all the $scope.
  5. $scope passes data and behavior to the View.

21) What is AngularJS BootStrap Process?

Bootstrap provide cross platform implementation of UI having consistency among internal tools. It is of two types:

  1. Automatic Bootstrap
  2. Manual Bootstrap

22) How would you specify that a scope variable should have one-time binding only?

We can specify the scope by using “::” in front of it. It allows you to check the available variable bindings in AngularJS.

23) Describe angular.copy() method in AngularJS?

angular.copy() method creates a deep copy of the variable. A deep copy of a variable means it doesn’t point to the same memory reference as that variable.

24) What is DDO Directive Definition Object?

DDO is an object used while creating a custome directive.

25) What is an interceptor?

An interceptor is a middleware code where all the $http requests go through. It is registered in $httpProvider. There are 2 types of requests that go through the interceptor, request and response.

27) How to hide HTML element via button click?

It can be done by using directive ng-hide in conjunction with a controller to hide an HTML element on button click.

28) What is injector?

The injector is a service locator. It is used to retrieve object instances as defined by provider, instantiate types, invoke methods and load modules.

29) Explain what is string interpolation in Angular.js ?

Compiler during the compilation process matches text and attributes using interpolate service to see if they contains embedded expressions.

30) How does the digest phase work?

In digest cycle all scope models are compared against their previous values. If changes are detected, the watches set on that model are fired. Then another digest cycle executes, and so on until all models are stable.

Facebooktwitterredditpinterestlinkedinmailby feather

Leave a Comment