Top 5 Angular Interview Questions

  1. Advantages/disadvantages of Angular
  2. Change Detection in Angular
  3. Dependency Injection in Angular
  4. RxJS library
  5. App Performance Optimization

Advantages/disadvantages of Angular

  • Advantages: TypeScript, Powerful CLI, Dependency Injection, All-in solution
  • Disadvantages: Complexity, Bundle Size, smaller Community

Change Detection

  • When to re-render view when data changes
  • Traversal dom tree to detect change => expensive
  • Use OnPush to optimize: only run change detection when Inputs change or from DOM Events

Dependency Injection

  • A Design Pattern implemented by Angular
  • Detail implementation is delegated to other classes
  • 2 types of injector: Module injector and Component injector
  • Resolve injector: look upside from Component to Parent injector
  • Resolution modifier: @Optional, @Self, @SkipSelf, @Host

RxJS

  • Library to implement Reactive Programming
  • Observable vs Promise
  • Operators: switchMap, flatMap, concatMap, exhaustMap…
  • Subjects: Subject, BehaviorSubject, ReplaySubject…
  • Memory leak: unsubscribe, async pipe

Performance Optimization

  • Build optimization: AoT
  • Lazy loading, differentiate loading
  • Treeshakeable
  • Runtime optimization: OnPush, trackBy, avoid function call in template => pure pipe, image optimization (src set), CDN…

Bonus Questions

  • How do you update your knowledges in Angular

Leave a comment