Angular Interview Questions

May 28, 2015 0 Comments by

Preparing for an AngularJS Role

Here are some tips on killing your next Angular Interview. Be prepared to answer some basic questions on:

You should know what happens when you minify and how to handle this.

Persisting Data in Angular

Sometimes you'll see data persisted in controllers. These get cleaned up everytime user switches a route. A better place is to keep this in services.


Create an object and return it. When passed into a controller, the properties defined on that object will be available in the controller.


Used like constructor functions. Any properties set on the this keyword will be available in the controller when this is passed in.


Can be passed into config(). When you need module-wide config for your service object.



Use protractor for E2E testing

Angular Style Guide

  • Use $timeout instead of setTimeout to make testing easier. Also do the same for $interval, $window, $document, $http
  • Use promises instead of callbacks
  • Use $resource instead of $http
  • Avoid globals and use dependency injection
  • Avoid prefixing variables and methods with $

General Knowledge

  • Angular expressions are different from JavaScript expressions. No control-flow statements are allowed.
  • Karma is a command-line test runner. Protractor is for E2E tests in the browser.
  • Event aggregation in Angular is done with $broadcast, $emit, and $on
  • Exceptions are handled with the $exceptionHandler service. These can be decorated to log exceptions to a service.
  • Interceptors are generally used to check authenticity of a request before sending to the server.
  • Transforms allow us to tweak a response before or after an http request or response

Tag cloud