AngularJS is a JavaScript open-source frontend web application framework that can be added to an HTML page with a <script> tag. It is one of the highly-sought skills that employer’s look for in a web developer.

Web development has been a lucrative profession with the growth of the internet and businesses creating websites to make their presence known on the internet. High-skilled web developers are in huge demand as businesses not only want to develop websites but also maintain them. As an expert web developer, one should be proficient in many web application frameworks and tools.

If you are appearing for an AngularJS interview and want to be prepared, this article will provide you with some of the common AngularJS Interview Questions (with answers):

Q1. What is AngularJS?

Ans. AngularJS is a client-side JavaScript Model-View-Controller (MVC) framework used for developing rich and extensible web applications. It mainly runs on plain JavaScript and HTML and is suitable for Single Page Applications (SPA).

Q2. Mention the major differences between AngularJS and JavaScript Expressions.

Ans. Some of the significant differences between AngularJS and JavaScript Expressions are –

AngularJS JavaScript
AngularJS is an Open Source framework JavaScript is an Object-Oriented Language
AngularJS expressions can be written in HTML JavaScript expressions cannot be written in HTML
AngularJS expressions don’t support conditionals, loops, and exceptions JavaScript expressions support conditionals, loops, and exceptions
AngularJS expressions support filters, JavaScript expressions do not support filters
AngularJS works on the model view controller JavaScript is based on dynamic typing concept as an interpreted language

Q3. What are the different features of AngularJS?

Ans. The essential features of AngularJS are –

  • Architecture
  • Codeless
  • Data Binding
  • Deep Linking
  • Dependency Injection
  • Directives
  • Not Browser Specific
  • Productivity
  • Routing
  • Speed and Performance

Q4. What are Directives in AngularJS?

Ans. AngularJS lets you extend HTML with new attributes called Directives. Some of the built-in Directives are – ngBind, ngModel, ngClass, etc.

Q5. What are Expressions in AngularJS?

Ans. Expressions in AnjularJS are used to bind application data to HTML. They are written inside double braces like {{expression}} and behave in the same way as ng-bind directives. They are pure JavaScript expressions and output the data where they are used. E.g. <p>Name: {{name.title}}</p>

Q6. Explain $scope in Angular?

Ans. ‘$scope’ is an object instance of a controller. ‘$scope’ object instance gets created when ‘ng-controller’ directive is encountered. E.g.

function Function1($scope)

$scope.ControllerName = “Function1”;

function Function2($scope)

$scope.ControllerName = “Function2”;

Q7. What should be the maximum number of concurrent “watches”?

Ans. There should be a maximum of 2000 to reduce memory consumption and improve performance.

Q8. What is a Digest Cycle in AngularJS?

Ans. A Digest Cycle is the code that runs at an interval. This interval may sometimes be simply as fast as possible after the previous one, and sometimes the interval is set.

Q9. How can you decrease Digest Cycle Time?

Ans. Digest Cycle Time can be decreased by decreasing the number of watchers.


Q10. How do you share data between Controllers?

Ans. By creating an AngularJS service that will hold the data and inject it inside of the controllers.

Q11. Can we force the digest cycle to run manually?

Ans. Yes, we can force the digest cycle to run manually.

Q12. What is Data Binding in AngularJS?

Ans. The automatic synchronization of data between the model and view components is referred to as Data Binding in AngularJS.

Also, Read>> Best IT Companies to Work for in India.

Q13. What is Currency Filter? What are the two ways to use Currency Filters?

Ans. The “Currency” Filter includes the “$” Dollar Symbol as the default. We can use Currency Filter in two ways-

default, where the Dollar-sign will be used in default. E.g. {{amount | currency}}

user-defined, where the user defines the currency. E.g. Indian Currency {{amount | currency:”&# 8377″}}

Q14. What is Dependency Injection?

Ans. Dependency Injection is a process where we inject the dependent objects rather than the consumer creating the objects.

Q15. What are the benefits of Dependency Injection?

Ans. There are two benefits of dependency injection – Decoupling and Testing.

Also, Read>> Best IT Companies to Work for in India.

Q16. What are the different types of Directive?

Ans. The different types of Directives are –

  • Element directives
  • Attribute directives
  • CSS class directives
  • Comment directives

Q17. Name different types of Linking Function.

Ans. The two types of Linking Functions are pre-linking function and post-linking functions.

Q18. What is the difference between One-Way Binding and Two-Way Binding?

Ans. One-Way Binding implies that the scope variable in the HTML will be set to the first value its model is bound to.

Two-Way Binding implies that the scope variable will change its value every time its model is assigned to a different value.

Q19. What is the “$rootScope” in AngularJS?

Ans. Scope provides a separation between View and its Model. Every application has a $rootScope provided by AngularJS, and every other scope is its child scope.

Q20. What is the SPA (Single page application) in AngularJS?

Ans. SPAs are web applications that load a single HTML page and dynamically update that page as the user interacts with the app.

Q21. Which directive is used to hide elements from the HTML DOM by removing them from that DOM and not changing their styling?

Ans. ngIf Directive is used to hide elements from the HTML DOM by removing them from that DOM and not changing their styling

Also, Read>> Online Learning Vs. Traditional Learning!

Q22. How do you disable a button depending on a checkbox’s state?

Ans. We can disable a button depending on a checkbox’s state by using the ng-disabled directive.

Q23. What is Representational State Transfer (REST) in AngularJS?

Ans. REST is a style of API that operates over HTTP requests. The requested URL identifies the data to be operated on, and the HTTP method identifies the operation that is to be performed.

Also, Read>> Online Learning Vs. Traditional Learning!

Q24. When should you use an Attribute versus an Element?

Ans. An Attribute is used when we are decorating an existing element with new functionality.

An Element is used when we are creating a component that is in control of the template.

Q25. What is DDO (Directive Definition Object)?

Ans. DDO is an object used while creating a custom directive.

Q26. What is the Provider Method in AngularJS?

Ans. The Module.provider method allows us to take more control over the way that a service object is created or configured.

Q27. What are the attributes that can be used during the creation of a new AngularJS Directives?

Ans. Restrict, Template URL, Template, Replace, Transclude, Scope, Require, Controller, Link, and Compile are used during the creation of a new AngularJS Directives.

Q28. What is the Controller in AngularJS?

Ans. A Controller is a set of JavaScript functions that are bound to a specified scope, the ng-Controller directive.

Q29. What are the Angular Modules?

Ans. The Angular Modules collectively define an angular application that enables one to write angular codes. It is a mechanism to group components, directives, pipes, and interrelated services. Angular Modules create an application by combining with other modules.

Q30. What are the directive scopes in AngularJs?

Ans. There are three directive scopes in AngularJs.

Parent scope – Any change made in the directive comes from the parent scope. It is also a default scope.

Child scope – This scope inherits a property from the parent scope.

Isolated scope – It is a reusable scope when a self-contained directive is built. It does not have any properties of the parent scope.

Q31. What is the Template?

Ans. Templates are the static HTML part of the Angular app and comprise of attributes and directives. They have an additional syntax that ensures customized user experience through a data injection process.

Q32. What is Internationalization?

Ans. Internationalization is used to create multilingual websites. It facilitates presenting locale-specific information on a website.

Q33. How will you share data between controllers?

Ans. We can share data between controllers using the Shared Data Service method. Other ways of sharing the data between controllers are –

  • Using $parent in HTML code
  • Using $parent in child controller
  • Using controller inheritance
  • Using events
  • Using the $rootScope

Q34. What is the String Interpolation?

Ans. String Interpolation is a service to evaluate angular expressions by matching the text and attributes to see if they have any embedded expressions.

Q35. What are AngularJS prefixes $ and $$?

Ans. These prefixes are used to avoid any accidental code collision with the user’s code.

$ prefix – Used with public objects

$$ prefix – Used with private objects

Q36. What is Strict Contextual Escaping?

Ans. Strict Contextual Escaping is a mode in which AngularJS constraints untrusted binding values. Here the AngularJS automatically runs security checks or shows an error if it cannot guarantee the security of the result.

Q37. What are the different types of Directives?

Ans. Different types of directives include –

  • Attribute directives
  • CSS class directives
  • Comment directives
  • Element directives

Q38. What is the Factory Method?

Ans. Factory Method is a process of creating the directive, and it is invoked only when a compiler matches the directive for the first time. We can use $injector.invoke to invoke the factory method.

Q39. What is Deep Linking?

Ans. Deep Linking enables encoding the application state in any URL such that it can be bookmarked, and the application can be restored.

Q40. What is the role of $routeProvider in AngularJs?

Ans. $routeProvider helps to navigate between different pages or links without loading them separately. It is configured by using ngRoute config().

Q41. What is an ng-App directive?

Ans. ng-App directive appoints the root element of an AngularJs application by defining the AngularJs application. In an HTML document, any number of ng-App directives can be defined, but only one AngularJS application can be auto-bootstrapped, and the rest need to be done automatically.

For example:

<div ng-app=””>

<p>My first expression: {{127 + 162}} </p>


Q42. What is ng-switch?

Ans. In AngularJs, ng-switch conditionally exchanges the structure of the Document Object Model (DOM) on a scope-based expression template. In simpler words, it is used to show/hide the child elements on the HTML page.

Q43. What are the AngularJs Global API?

Ans. It is a set of global JavaScript functions such as protocols, routines, and tools for building software applications. Global API helps the users to perform tasks like compare and iterate objects, and convert data while interacting with the application.

Q44. Name some common API functions.

Ans. Some of the common API functions are –

angular. Lowercase – Converts a string to lowercase string

angular. Uppercase – Converts a string to uppercase string

angular. isString – Returns true if the reference is a string

angular. isNumber – Returns true if the reference is a number

Q45. How will you validate a URL?

Ans. A URL can be validated by adding the regex directly to the ng pattern to the attribute.

 Q46. What is Event Handling?

Ans. Event Handling in AngularJs is used to create advance AngularJs applications.

 Q47. Is AngularJS compatible with all browsers?

Ans. Yes, it is compatible with all browsers, including Google Chrome, Mozilla Firefox, Safari, Opera, Internet Explorer, and Mobile browsers.

Q48. When do we use a $location?

Ans. $location keeps track of the application URL and makes it available to a controller. $location can be used any time an application needs to react to a change in the existing URL or whenever we want to change the current URL in the browser.

Q49. Explain the difference between Compile and Link.

Ans. Compile – It traverses the HTML, finds for all the directives, and returns a link function.

Link – It combines the model with a view. In case of any change in model, it is reflected in view, and in case of any change in view, it is reflected in the model.

Q50. Differentiate between sessionStorage, cookies, and localStorage.

Ans. SessionStorage – It stores data for a particular session, and data will be lost when a browser tab is closed. Maximum storage is up to 5MB.

Cookies – It stores data that has to be sent back to the server or every HTTP request. Expiration can be set from either the server-side or client-side, varying on the type and duration. Maximum storage is up to 4KB.

LocalStorage – It stores with no expiration date, and data can only be cleared by JavaScript or by clearing the browser cache. The storage limit is more than both sessionStorage and cookies.

Q51. Give an example to define a custom event.

Ans. Custom event can be defined using “objEvent = new EventEmitter()”

Q52. Which method of RouterModule is used for providing all routes in AppModule?

Ans. RouterModule.forRoot

Q53. What is the procedure to implement a multiple API calls that need to happen in order using rxjs?

Ans. Following is the procedure to implement a multiple API calls:

Method 1:

this.http.get(‘/api/url’).subscribe(data => {

this.http.get(/api/url/data).subscribe(data11 => {



Method 2:

Using “MergeMap”


mergeMap(character => this.http.get(character.naukrilearning))


Q54. What type of data can be used with an async pipe?

Ans. Promise, Observable can be used with an async pipe.

Q55. What are the ways components follow to communicate with each other?

Ans. There are three ways to communicate with components:

  • Passing a component to another component
  • passing value by using parent component
  • passing through service

Q56. What is the procedure to create two-way data binding in Angular?

Ans. By combining the input and output binding into a single notation using the ngModel directive.

Example: <input [(ngModel)]=”name” >  {{name}}

Q57. Explain the difference between RouterModule.forRoot() vs RouterModule.forChild()?

Ans. RouterModule.forRoot is known as a static method, and it is used to configure the modules.

RouterModule.forChild() is also a static method used to configure the routes of lazy-loaded modules.

Q58. What is the procedure to debug the router?

Ans. It can be initiated by passing a flag when it’s added to the app routes.



imports: [ RouterModule.forRoot(routes, { enableTracing: true }) ],

exports: [ RouterModule ]


export class AppRoutingModule {}

Q59. Mention the building blocks of the angle.

Ans. Following are the building blocks of the angle:

  • Blocks
  • Lane
  • Template
  • Component
  • Services
  • Pro injection
  • Orders
  • Data Nemo

Q60. Mention angle life cycle hooks.

Ans. Following are the angle life cycle hooks:

  • ngAfterViewInit ()
  • ngOnInit ()
  • ngDoCheck ()
  • ngOnChanges ()
  • ngAfterViewChecked ()
  • ngOnDestroy ()
  • ngAfterContentInit ()
  • ngAfterContentChecked ()

Q61. What is the procedure to update or upgrate angle cli version?

Ans. To upgrade the application, we need to enable the following commands:

  • npm error cache clean or npm cache (npm> 5 if)
  • npm install -g @ angular / cli @ upgrade version
  • npm uninstall -g angular-cli

Q62. Mention the ways to create a decorator in the angle?

Ans. Following are two ways to create a decorator in angles:

  • Module.decorator
  • $ provide.decorator

Q63. Mention the types of NgModules.

Ans. There are four types of NgModules:

  • Service block
  • Widget block
  • Features module
  • Replacement module
  • Shared volume

Q64. Mention the latest version of angular?

Ans. Angular 8 is the latest version of angular.

Q65. Mention the types of built-in pipes.

Ans. Following are the types of built-in pipes:

  • Titlecase
  • Uppercase
  • Lowercase
  • Percent
  • Slice
  • Currency
  • Date
  • Decimal
  • Json


These are some of the popular AngularJS interviews questions. Always be prepared to answer all types of questions — technical skills, interpersonal, leadership or methodology. If you are someone who has recently started your career in web development, you can always get certified in one of the technical courses like AngularJS to get the requisite coding skills and methodologies.