Home Interview Questions Top 28 AngularJS Interview Questions And Answers PDF 2019

Top 28 AngularJS Interview Questions And Answers PDF 2019

414
0
Top 28 AngularJS Interview Questions And Answers PDF

Top 28 AngularJS Interview Questions And Answers PDF: Here are the top interview questions of AngularJS. Be prepared for the interview. You can download the entire questions in a pdf format. so guys All the best for your interview.

1) What is AngularJS?

AngularJS is a JavaScript framework, i.e., used to create a single web page application. It follows MVC (Model View Controller) pattern. It is an open source, cross-browser compliant and easy to maintain.


2) What are the advantages of AngularJS?

  • Allows us to create a single page application
  • Follows MVC pattern
  • Predefined form validations
  • Supports animation
  • Open source
  • Cross-browser compliant
  • Supports two-way data binding
  • Its code is unit testable

3) What are the disadvantages of AngularJS?

  • JavaScript Dependent: If end user disables JavaScript, AngularJS will not work.
  • Not Secured: It is a JavaScript-based framework, so it is not safe to authenticate the user through AngularJS only.

You might like: Top 40 Android Interview Question And Answers PDF in 2019


4) Is AngularJS dependent on JQuery?

No. AngularJS is a JavaScript framework whereas JQuery is a JavaScript library.


5) What IDE’s are currently used for the development of AngularJS?

  • Eclipse – It is one of the most popular IDE. It supports AngularJS plugins.
  • Visual Studio – It is an IDE from Microsoft that provides a platform to develop web apps easily and instantly.
  • WebStorm – It is one of the most powerful IDE for modern JavaScript development. It provides an easier way to add dependencies with angular CLI
  • Aptana – It is a customized version of Eclipse. It is free to use.
  • Sublime Text – It is one of the most recommendable editors for HTML, CSS, and JavaScript. It is very much compatible with AngularJS code.

6) With options on page load how you can initialize a select box ?

Top 28 AngularJS Interview Questions And Answers PDF: You can initialize a select box with options on page load by using ng-init directive

  • <div ng-controller = ” apps/dashboard/account ” ng-switch
  • On = “! ! accounts” ng-init = ” loadData ( ) “>

7) Explain what are directives ? Mention some of the most commonly used directives in AngularJS application ? 

A directive is something that introduces new syntax, they are like markers on DOM element which attaches a special behavior to it. In any AngularJS application, directives are the most important components.

Some of the commonly used directives are ng-model, ng-App, ng-bind, ng-repeat , ng-show etc.

8) Mention what are the advantages of using AngularJS ?

AngularJS has several advantages in web development.

  • AngularJS supports MVC pattern
  • Can do two ways data binding using AngularJS
  • It has per-defined form validations
  • It supports both client server communication
  • It supports animations

9) Explain what Angular JS routes does ?

Angular js 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 AngularJS is called a route

A value in Angular JS 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 AngularJS module.

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

10)  Explain what is data binding in AngularJS ?

Automatic synchronization of data between the model and view components is referred as data binding in AngularJS.  There are two ways for data binding

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

11) What are the services in AngularJS?

Services are objects that can be used to store and share data across the application. AngularJS offers many built-in services such as $http, i.e., used to make XMLHttpRequest.


12) What is the module in AngularJS?

Top 28 AngularJS Interview Questions And Answers PDF: A module is a container for the different parts of application like controller, services, filters, directives etc. It treats as a main() method. A module is created using an angular object’s module() method. For example:

  1. var app = angular.module(‘myApp’, []);    

13) What is the scope in AngularJS?

A Scope is an object that represents the application model.

Each AngularJS application can have only one root scope but can have multiple child scopes. For example:

  1. var app = angular.module(‘myApp’, []);    
  2. app.controller(‘myCtrl’, function($scope) {    
  3.     $scope.carname = “Volvo”;    
  4. });   

14) What is routing in AngularJS?

A routing is a mechanism that builds an application as a Single Page Application. It routes the application to different pages without reloading the application.


15) What is a template in AngularJS?

A template consists of HTML, CSS and AngularJS directives that are used to render the dynamic view.


16)  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.

17)  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.

You might like: Ruby on Rails Interview Questions and Answers PDF download 2019

18)  Explain what is factory method in AngularJS?

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.

19)  Mention 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

20)  Mention 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

21) What is a template in AngularJS?

A template consists of HTML, CSS and AngularJS directives that are used to render the dynamic view.


22) What are the expressions in AngularJS?

Top 28 AngularJS Interview Questions And Answers PDF: Expressions are the code snippets that resolves to a value. AngularJS expressions are placed inside {{expression}}. For example:

  1. {{1+1}}  

AngularJS supports one-time binding expressions.


23) What is the use of a filter in AngularJS?

A filter is used to format the value of the expression to display the formatted output. AngularJS enables us to write our filter. Filters can be added to expressions by using the pipe character |, followed by a filter. For example:

  1. <div ng-app=”myApp” ng-controller=”personCtrl”>    
  2. <p>The name is {{ firstName | uppercase }}</p>    
  3. </div>    
  4. <script>    
  5. angular.module(‘myApp’, []).controller(‘personCtrl’, function($scope) {    
  6.     $scope.firstName = “Sonoo”,    
  7.     $scope.lastName = “Jaiswal”    
  8. });    
  9. </script>   

24) What are the different types of filters in AngularJS?

  1. Currency – It formats a number to a currency format.
  2. Date – It formats a date to a specified format.
  3. Filter – It selects a subset of items from an array.
  4. JSON – It formats an object to a Json string.
  5. Limit – It is used to limit an array/string, into a specified number of elements/characters.
  6. Lowercase – It formats a string to lower case.
  7. Number – It formats a number to a string.
  8. Orderby – It orders an array by an expression.
  9. Uppercase – It formats a string to upper case.

25. Explain what the link function is and how it differs from compile.

The link function combines the directives with a scope to produce a live view. 

The link function is responsible for instance DOM manipulation and for registering DOM listeners.

The compile function is responsible for template DOM manipulation as well as the collection of all the directives.

26. Explain e2e testing of AngularJS applications.

End-to-end (e2e) testing involves testing an application from start to finish to determine whether all the components are working properly. It catches issues within an application related to integration and flow. 

27. What is dependency injection?

Dependency injection is the process where the dependent objects are injected rather than being created by the consumer. 

28. What are the benefits of dependency injection?

Dependency injection has two major benefits: Testing and decoupling. 

29. What is Single Page Application (SPA)?

Top 28 AngularJS Interview Questions And Answers PDF: SPA is the concept whereby pages are loaded from the server not by doing post backs, rather by creating a single shell page or master page and loading the web pages into the master page.

30. How can SPA be implemented in AngularJS?

SPA can be implemented with Angular by using Angular routes

31. How can digest cycle time be decreased?

Digest cycle time can be decreased by decreasing the number of watchers. To do this you can: 

  • Use web worker
  • Work in batches
  • Cache DOM
  • Remove unnecessary watchers
  • Use one-time Angular binding

Top 28 AngularJS Interview Questions And Answers PDF Download

Check out Latest Posts: