AngularJS interview questions and answers for legacy front ends

AngularJS interview questions are mostly asked by teams that still run a 1.x application and need someone who can keep it healthy or move it off the framework. Expect questions on scopes and prototypal inheritance, the digest cycle and why a change made outside Angular does not show up, directives with isolate scope, services versus factories, and minification-safe dependency injection. Senior rounds add performance with many watchers, template injection, and how you would migrate one screen at a time.

By Published 8 min read

AngularJS versus Angular in interviews

AngularJS is the original 1.x framework from Google, built around scopes, two-way binding and dirty checking. Angular (version 2 onward) is a rewrite in TypeScript with components, a different change-detection model and no $scope. Google ended official long-term support for AngularJS in early 2022, so the jobs that ask for it today are mostly maintenance, security hardening and migration work in banks, insurers, internal tools and older SaaS products. If the posting says "Angular" without a version, ask. Questions on the modern framework are covered in Angular interview questions.

  1. Concept questionsModules, controllers, scope, binding, directives, services and DI, usually in a quick-fire round.
  2. Debug a snippetA view that does not update, a child scope that hides a parent value, a directive that leaks event listeners.
  3. Build or extend something smallA component with one-way inputs and an output callback, or a service wrapping $http with caching.
  4. Maintenance and migrationHow you would speed up a slow screen, secure templates, and plan a move to Angular or another framework.

AngularJS fundamentals questions

Quick-fire AngularJS basics
QuestionWhat it testsWhat a strong answer shows
What is a module and how is an app bootstrapped?Structureangular.module('app', [deps]) registers components and their dependencies. ng-app on an element bootstraps automatically; angular.bootstrap does it manually, for example after loading config.
What is $scope?Core modelAn object that holds the view's data and functions. Scopes form a tree that mirrors the DOM and inherit prototypally from their parent, with $rootScope at the top.
Why use controllerAs syntax?Readabilityng-controller="OrderCtrl as vm" binds to the controller instance, so templates say vm.total and nested controllers do not shadow each other's plain properties.
ng-if versus ng-show?Directivesng-if removes and recreates the element and creates a child scope. ng-show toggles CSS display and keeps the element and its watchers alive.
What are filters?TemplatesFunctions used with a pipe in expressions, like {{ price | currency }} or orderBy. Filters in ng-repeat run on every digest, so heavy ones belong in the controller.
Service, factory or provider?DIA factory returns any value you build, a service is instantiated with new, and a provider can be configured in a config block before the app runs. All three produce singletons.
How does DI survive minification?DIAngularJS reads parameter names by default, which a minifier renames. Use array annotation (['$http', function ($http) {...}]), $inject, or a build step that adds annotations.
How do you call a REST API?$http$http.get(url) returns a promise; interceptors add auth headers or handle 401s globally. $q builds and combines promises.
ngRoute or ui-router?RoutingngRoute maps one URL to one view. ui-router uses states with nested views and resolves, which larger apps usually adopted.
How do AngularJS expressions differ from JavaScript?ExpressionsExpressions are evaluated against the scope, forgive undefined values, and cannot contain loops or most statements. Keep logic out of templates.
Quick-fire AngularJS basics. Scroll sideways on a small screen.

Scope and digest cycle questions

The digest cycle is the question AngularJS interviewers return to most. The model below is a plain JavaScript imitation of the idea: every watcher is evaluated, any change runs its listener, and the loop repeats until a full pass finds nothing dirty or gives up after ten passes.

const INIT = Symbol("init");

class Scope {
  constructor() { this.$$watchers = []; }
  $watch(watchFn, listenerFn) {
    this.$$watchers.push({ watchFn, listenerFn, last: INIT });
  }
  $digest() {
    let ttl = 10, dirty, rounds = 0;
    do {
      dirty = false;
      rounds++;
      for (const w of this.$$watchers) {
        const value = w.watchFn(this);
        if (value !== w.last) {
          const old = w.last === INIT ? value : w.last;
          w.last = value;
          w.listenerFn(value, old, this);
          dirty = true;
        }
      }
      if (dirty && ttl-- === 0) throw new Error("10 digest iterations reached, aborting");
    } while (dirty);
    return rounds;
  }
}

const scope = new Scope();
scope.price = 20;
scope.qty = 2;
scope.$watch((s) => s.price * s.qty, (v, old, s) => { s.total = v; });
scope.$watch((s) => s.total, (v) => console.log("total is", v));
console.log("rounds:", scope.$digest());

scope.qty = 3;               // a change made outside the loop is invisible...
console.log("rounds:", scope.$digest()); // ...until something runs a digest

const bad = new Scope();
bad.n = 0;
bad.$watch((s) => s.n, (v, old, s) => { s.n = v + 1; }); // listener changes what it watches
try { bad.$digest(); } catch (e) { console.log(e.message); }

// total is 40
// rounds: 2
// total is 60
// rounds: 2
// 10 digest iterations reached, aborting
A miniature dirty-checking loop. Run with Node; the real framework does more (async queue, $evalAsync, exception handling), but the shape is the same.
  • Why does the view not update after a setTimeout or a jQuery callback? The change happens outside Angular's context, so no digest runs. Wrap it in $scope.$apply(), or better, use $timeout, $interval and $http, which trigger a digest for you.
  • $apply versus $digest? $digest checks the current scope and its children. $apply runs your function, then digests from $rootScope, so every binding on the page is checked. Calling $apply inside a running digest throws an "already in progress" error.
  • What causes the infinite digest error? A watcher whose listener keeps changing the value it or another watcher reads, or a watch function that returns a new object or array every time. The bad scope in the sample shows the first case.
  • $watch, $watchCollection or a deep watch? A plain watch compares by reference, $watchCollection checks the items of an array or object one level deep, and a deep watch (third argument true) copies and compares the whole structure, which is the most expensive.
  • What is the dot rule? A child scope that assigns name creates its own property and hides the parent's, because of prototypal inheritance. Binding to form.name or using controllerAs avoids the surprise, which shows up most with ng-if, ng-repeat and ng-include.
  • How do $emit and $broadcast differ? $emit travels up the scope tree, $broadcast travels down. Broadcasting from $rootScope reaches every scope, which gets slow and hard to trace; a shared service is often cleaner.
  • What is a one-time binding? {{ ::user.name }} stops watching once the value is defined, which cuts watchers on read-only content.

Directives and components questions

angular.module("shop").component("cartLine", {
  bindings: {
    item: "<",        // one-way input
    onRemove: "&",    // callback to the parent
  },
  template:
    '<span>{{ $ctrl.item.name }} x {{ $ctrl.item.qty }}</span>' +
    '<button ng-click="$ctrl.onRemove({ id: $ctrl.item.id })">Remove</button>',
  controller: function () {
    this.$onChanges = function (changes) {
      if (changes.item) this.item = angular.copy(this.item); // do not mutate the parent's object
    };
  },
});
A component with one-way input, an output callback and lifecycle hooks. Not executed here (needs the AngularJS library and a browser).
  • Isolate scope binding symbols? @ reads an attribute string, = is two-way, < is one-way, and & passes an expression the child can call. Components favor < and & so data flows down and events flow up.
  • compile, link and controller: what runs when? compile runs once per template to transform it, link runs per instance to wire the DOM and scope (pre-link then post-link), and the controller runs before pre-link so sibling directives can require it.
  • What is transclusion? Letting a directive wrap content supplied by its user, such as a panel with a custom body, through transclude: true and ng-transclude, with multi-slot variants for headers and footers.
  • directive() or component()? The component helper, added in later 1.x releases, is a simpler directive with isolate scope, controllerAs $ctrl and lifecycle hooks. Directives remain for attribute behaviors and DOM manipulation.
  • What are restrict, priority and terminal? restrict picks element, attribute or class usage. priority orders several directives on one element, and terminal stops lower-priority directives from compiling, which is how ng-if and ng-repeat take control.
  • How do you avoid leaks in a directive? Remove event listeners on non-Angular objects and cancel $interval or $timeout in the $destroy handler or $onDestroy hook.

Senior AngularJS: performance, security and migration

Scenarios for experienced candidates
ScenarioWhat to say you would checkWhat you would change
A grid page freezes when typing into a filter box.Watcher count on the page, filters inside ng-repeat, deep watches.track by on ng-repeat, one-time bindings for static cells, filter in the controller with a debounce (ng-model-options), paginate or virtualize the list.
Server-rendered user text appears inside an ng-app element.Whether attackers can inject {{ }} expressions that AngularJS evaluates (client-side template injection).Never mix server templating with user input inside the app root; use ng-non-bindable where needed, and sanitize with $sce and ngSanitize.
Memory grows the longer a user stays on the app.Listeners on window or document, intervals, and third-party widgets not torn down on route change.Cleanup in $destroy, and a heap snapshot comparison before and after navigating away.
The team must leave AngularJS.Size of the app, test coverage, shared services, and how routing is done.Refactor to components with one-way bindings first, then migrate route by route, either with a hybrid Angular setup (ngUpgrade) or by running the new framework beside the old one behind a router split.
Unit tests are slow and brittle.Tests that hit real HTTP or depend on digest timing.ngMock with $httpBackend to stub calls, $componentController for component logic, explicit $digest or flush in tests.
The app must pass a strict Content Security Policy.Inline scripts and features that rely on eval-like behavior.Enable CSP mode (ng-csp) and move inline scripts out, then test every screen.
Scenarios for experienced candidates. Scroll sideways on a small screen.
  • Why does track by matter? Without it, ng-repeat tracks items by a generated hash, so replacing an array with fresh objects from the server destroys and recreates every row. track by item.id reuses DOM nodes.
  • How do you count watchers? A small snippet that walks the scope tree from $rootScope and sums $$watchers, or a browser extension. Rising counts point at the screen to fix first.
  • How would you explain the migration plan to a manager? Name the end state, the order of screens by risk and traffic, what keeps running in parallel, and how you will prove each step did not break behavior.

Fictional example

Answering "Why doesn't the badge update?"
Interviewer
A notification badge reads vm.count. A WebSocket handler written with the browser API sets vm.count = data.count, but the badge only changes when the user clicks something. Why?
Candidate
The socket callback runs outside AngularJS, so no digest starts and the binding is not re-checked until the next click triggers one. The quick fix is to make the assignment inside $scope.$apply, or $scope.$applyAsync if messages arrive in bursts, so several updates share one digest. The better fix is a small socket service that owns the connection, applies updates through Angular and exposes the count, so controllers do not each call $apply. I would also close the socket on $destroy so the listener does not outlive the screen.

AngularJS practice plan

  • Days 1 and 2: rebuild the digest sample above, then break a real AngularJS page on purpose with setTimeout and fix it with $timeout and $apply.
  • Days 3 and 4: write one component with < and & bindings and lifecycle hooks, and one attribute directive that cleans up its listeners.
  • Day 5: take a slow list, count watchers, then add track by, one-time bindings and pagination and count again.
  • Day 6: write a one-page migration plan for an app you know, naming the first screen to move and why.
  • Day 7: practice explaining scope inheritance, $apply versus $digest, and service versus factory in under a minute each.

AngularJS front ends often sat on server views; ASP.NET MVC interview questions covers that back end. Hybrid mobile apps from the same era wrapped AngularJS inside a WebView, and testing them is part of Appium interview questions. For the language underneath, see JavaScript interview questions.

Debugging questions on old frameworks reward naming the mechanism, not just the fix. Natively, an AI interview assistant for Mac and Windows, keeps a transcript of a mock front-end round on your computer so you can check whether you explained why the digest never ran. In practice sessions it can read a template or console error from a screenshot and suggest what to mention, and with Pro or the free trial it can work from the résumé and job description you add. Notes and transcripts stay available for review.

Questions people ask

What AngularJS questions are asked in interviews?

Scope and prototypal inheritance, the digest cycle and $apply, two-way versus one-way binding, directives and components with isolate scope, services versus factories, minification-safe DI, performance with many watchers and migration plans.

Is AngularJS the same as Angular?

No. AngularJS is the original 1.x framework built on scopes and dirty checking. Angular, from version 2 onward, is a TypeScript rewrite with components and a different change-detection model.

Why doesn't my AngularJS view update after a callback?

The callback ran outside AngularJS, so no digest cycle started. Wrap the change in $scope.$apply, or use $timeout, $http or a service that applies updates for you.

Are AngularJS skills still in demand?

Mostly for maintaining, securing and migrating existing applications, since official long-term support has ended. Interviewers for these roles value migration experience as much as framework knowledge.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP