Change Detection: Default vs OnPush, Zone.js e Zoneless
"How does Angular's Change Detection work under the hood? Explain the difference between `Default` and `OnPush`, the role of `Zone.js`, and how Zoneless Change Detection changes the model."
100 perguntas técnicas em inglês (Mid-Senior / Senior) com gabaritos sênior, Green/Red Flags, guias de estudo, mini-drills e apostila completa — calibrado para 5 anos de XP (2 anos Fullstack Java + Angular, 3 anos Frontend Angular).
"How does Angular's Change Detection work under the hood? Explain the difference between `Default` and `OnPush`, the role of `Zone.js`, and how Zoneless Change Detection changes the model."
"Explain Angular Signals (`signal`, `computed`, `effect`, and `linkedSignal`). How does Angular track dependencies automatically, and what does 'glitch-free' execution mean?"
"Now that Angular has Signals, is RxJS dead? How do you decide between Signals and RxJS in a real production codebase, and how do you bridge them?"
"Walk me through Angular's Dependency Injection hierarchy. How does resolution work between `ElementInjector` and `EnvironmentInjector`, and when would you use resolution modifiers or `InjectionToken`?"
"Why did Angular move from `NgModule` to Standalone Components (now the default)? How does Standalone affect lazy loading, DI scoping, and bundle size, and how would you migrate a large NgModule app?"
"Compare traditional Angular Lifecycle Hooks (`ngOnChanges`, `ngOnInit`, `ngAfterViewInit`, `ngOnDestroy`) with modern Signal-based component APIs (`input()`, `output()`, `model()`, `viewChild()`, `afterNextRender()`)."
"What are the benefits of Angular's built-in Control Flow (`@if`, `@for`, `@switch`, `@let`) and Deferrable Views (`@defer`) over `*ngIf`/`*ngFor` and manual dynamic imports?"
"How do you build highly reusable and customizable Angular components using Content Projection (`ng-content`), `ngTemplateOutlet`, and Host Directives (Directive Composition API)?"
"How do you render components dynamically at runtime in Angular, and how does `ViewEncapsulation` (`Emulated`, `None`, `ShadowDom`) work under the hood?"
"How do you architect HTTP communication in Angular? Discuss `HttpClient`, Functional Interceptors (e.g., auth headers and token refresh), and how the newer Resource API (`resource`, `rxResource`, `httpResource`) fits in."
"Explain the difference between Cold and Hot Observables in RxJS, and compare `Subject`, `BehaviorSubject`, `ReplaySubject`, and `AsyncSubject` with concrete Angular use cases."
"Compare `switchMap`, `mergeMap`, `concatMap`, and `exhaustMap`. Give a concrete real-world frontend scenario for each one and explain what bug happens if you pick the wrong one."
"When do you use `combineLatest`, `forkJoin`, `withLatestFrom`, and `zip`? Also, what are the hidden pitfalls of `shareReplay(1)`?"
"How does error handling work in RxJS streams? Explain why the placement of `catchError` inside vs. outside a `switchMap` matters, and how you implement retries with exponential backoff."
"How do memory leaks happen in Angular applications, and what are the modern best practices for managing subscriptions and cleaning up resources?"
"How do you choose a state management strategy in Angular? Compare local component Signals, Signal/BehaviorSubject Services, NgRx Store (Redux), NgRx SignalStore, and server-state tools like TanStack Query / `httpResource`."
"Explain the unidirectional data flow in NgRx Store, how Memoized Selectors work, and the most common NgRx anti-patterns you have seen in large enterprise apps."
"Compare Reactive Forms and Template-Driven Forms in Angular. How do you build reusable custom form controls with `ControlValueAccessor`, handle cross-field & async validation, and where do Signal Forms fit?"
"Walk through advanced Angular Router features: lazy loading (`loadComponent` / `loadChildren`), functional guards (`canActivate`, `canMatch`, `canDeactivate`), resolvers vs. in-component loading, preloading strategies, and `withComponentInputBinding()`."
"How do Server-Side Rendering (SSR), Static Site Generation (SSG), Hydration, Event Replay, and Incremental Hydration work in Angular? What browser-specific bugs must you avoid in SSR?"
"How would you structure a large-scale Angular codebase for multiple teams? Discuss Smart vs. Presentational components, Feature-based architecture, Nx Monorepos with module boundaries, and when to use (or avoid) Micro-Frontends."
"An Angular enterprise dashboard is feeling sluggish and laggy. Walk me through your systematic approach to diagnose and optimize its Angular-specific performance."
"How do you design a testing strategy for an Angular application? Discuss unit vs. integration vs. E2E testing, Jest/Vitest, Angular Testing Library / CDK Component Harnesses, testing Signals & RxJS, and mocking HTTP."
"How do you make an Angular application production-ready in terms of global error handling, observability/logging, feature flags, and internationalization (i18n)?"
"Explain how the JavaScript Event Loop works in the browser. What is the execution order between the Call Stack, Microtask Queue, Macrotask (Task) Queue, and `requestAnimationFrame` / browser rendering?"
"Explain Closures and Lexical Scope in JavaScript. Also explain how `this` binding works across regular functions, arrow functions, `call`/`apply`/`bind`, and how Prototypal Inheritance works under the hood."
"Compare `Promise.all`, `Promise.allSettled`, `Promise.race`, and `Promise.any`. How does `async/await` work under the hood, and how do you cancel in-flight async operations with `AbortController`?"
"Explain primitive vs. reference types in JavaScript, shallow vs. deep cloning (including `structuredClone`), why immutability is essential in Angular, and how `WeakMap`/`WeakSet` interact with Garbage Collection."
"How do ES Modules enable Tree-Shaking in modern bundlers like ESBuild, Vite, and Webpack? What prevents Tree-Shaking from working, and why can barrel files (`index.ts`) hurt bundle size and build performance?"
"Explain the differences between `any`, `unknown`, and `never` in TypeScript. When should you use `type` vs `interface`, and how do Discriminated Unions and Type Narrowing (`is`, `satisfies`, `asserts`) make Angular apps safer?"
"How do Generics, `keyof`, Indexed Access Types, Mapped Types, Conditional Types, and `infer` work in TypeScript? Give a practical Angular or frontend example where advanced types prevented bugs."
"TypeScript types disappear at runtime. How do you maintain end-to-end type safety across API boundaries in an Angular app, and which strict compiler flags matter most in production?"
"Explain the difference between `debounce` and `throttle`, how you would implement both from scratch in TypeScript, and how pure functions and memoization improve predictability and performance."
"Walk through the browser's Critical Rendering Path from receiving HTML bytes to pixels on the screen. What triggers Layout (Reflow), Paint, and Composite, and why should animations stick to `transform` and `opacity`?"
"Compare CSS Flexbox and CSS Grid — when do you choose each? Also explain how CSS Stacking Contexts (`z-index`) work, and how Container Queries (`@container`) and CSS Custom Properties improve component design."
"How does CSS specificity and the Cascade work, including modern Cascade Layers (`@layer`)? How do you structure scalable styles and theming (e.g., SCSS, BEM, Utility CSS, Angular Material M3) across a large app?"
"How do you build accessible web applications (WCAG AA)? Discuss semantic HTML, ARIA attributes, keyboard navigation and focus management (e.g., modals and custom dropdowns), and tools/APIs you use in Angular."
"Explain DOM Event propagation (Capturing, Target, Bubbling) and Event Delegation. Also discuss when to use `IntersectionObserver`, `ResizeObserver`, Web Workers, and Service Workers."
"Compare `localStorage`, `sessionStorage`, `IndexedDB`, and Cookies. Then explain how HTTP Caching works (`Cache-Control`, `ETag`, `Last-Modified`, `stale-while-revalidate`) and how you cache static assets vs API responses."
"Compare REST, GraphQL, WebSockets, and Server-Sent Events (SSE) for frontend data needs. Also explain how CORS works (including preflight `OPTIONS` requests) and the key performance differences between HTTP/1.1, HTTP/2, and HTTP/3."
"Explain the three Core Web Vitals (`LCP`, `INP`, `CLS`), their 'Good' thresholds, how Lab data differs from Field (RUM) data, and concrete strategies to improve each one in an Angular application."
"How do you optimize initial page load and asset delivery on the frontend? Cover responsive images (`NgOptimizedImage`, `srcset`, `AVIF`/`WebP`, `fetchpriority`), web fonts, resource hints (`preconnect`, `preload`, `prefetch`), and Critical CSS."
"How do you profile and debug runtime performance bottlenecks in the browser — such as Long Tasks (>50ms), UI jank, Layout Thrashing, large lists, and memory leaks — using Chrome DevTools and Angular DevTools?"
"Explain Cross-Site Scripting (XSS — Stored, Reflected, DOM-based), how Angular protects against it out of the box, the dangers of `DomSanitizer.bypassSecurityTrust*`, and how Content Security Policy (CSP) and Trusted Types add defense-in-depth."
"How should a modern Angular SPA handle authentication and authorization securely? Compare storing tokens in `localStorage` vs. `HttpOnly` Cookies vs. the BFF (Backend-for-Frontend) pattern, explain OAuth 2.0 Authorization Code Flow with PKCE, and how CSRF protection works."
"Beyond XSS and CSRF, what other frontend security threats should a Senior Frontend Engineer guard against? Discuss Clickjacking, Open Redirects, Supply Chain attacks (npm dependencies), Subresource Integrity (SRI), and secrets in client bundles."
"Design a scalable frontend architecture in Angular for a high-traffic interactive feature — such as a real-time search autocomplete with rich results, an infinite-scrolling feed, or a live financial dashboard. Walk me through your approach."
"How would you design and maintain an internal Angular UI Component Library / Design System consumed by multiple product teams?"
"You join a company with a 5-year-old Angular 14 enterprise app (heavy NgModules, `Default` change detection, nested `.subscribe()` calls, and slow builds). How do you modernize it incrementally to modern Angular (Standalone, Signals, Zoneless) without halting product delivery?"
"What do you look for when reviewing an Angular/TypeScript Pull Request? Also, how do you collaborate with Backend Engineers on API contracts and make pragmatic trade-offs between ideal architecture and delivery deadlines?"
"How does Angular's Ivy compiler work under the hood? Compare AOT vs. JIT compilation, explain strict template type checking, and contrast Angular's Incremental DOM with React's Virtual DOM."
"Explain the difference between HTML Attributes and DOM Properties in Angular bindings (`[attr.*]` vs `[prop]`), how `[class]`/`[style]` precedence works, and why modern Angular prefers the `@Component({ host: {} })` property over `@HostBinding` and `@HostListener`."
"When should you use `Renderer2` and the `DOCUMENT` injection token instead of directly mutating `ElementRef.nativeElement`? Also, walk me through how to build a custom Structural Directive using `TemplateRef` and `ViewContainerRef`."
"Walk through Angular's bootstrap sequence and explain how `provideAppInitializer()` (formerly `APP_INITIALIZER`) works. When should you block app startup to load runtime config vs. load data lazily after bootstrap?"
"How should you handle animations and route transitions in modern Angular? Discuss the deprecation of `@angular/animations` in favor of native CSS (`animate.enter` / `animate.leave`), the Router's `withViewTransitions()`, and `prefers-reduced-motion` accessibility."
"What is the Angular Component Dev Kit (CDK), and how do you use primitives like `Overlay`, `Portal`, `BreakpointObserver`, and `DragDrop` to build custom UI without being tied to Angular Material's styling?"
"Walk me through NgRx SignalStore (`@ngrx/signals`). How do `withState`, `withComputed`, `withMethods`, `withHooks`, `rxMethod`, `patchState`, and custom store features work together, and how does SignalStore handle immutability and scoping?"
"How do you handle advanced routing requirements in Angular — such as displaying a global navigation progress bar via Router events, restoring scroll positions (`withInMemoryScrolling`), preserving component state across tab navigations (`RouteReuseStrategy`), passing transient `history.state`, and using Named (Auxiliary) Outlets?"
"How do Angular Pipes work internally (including `AsyncPipe`, `DecimalPipe`, `DatePipe`, `CurrencyPipe`, and `KeyValuePipe`), how do you configure locale-aware formatting for international markets, and what are the pitfalls of `KeyValuePipe` and pipe chaining?"
"How do you architect a massive 60-field multi-section enterprise form in Angular without creating a 1,000-line monolithic component? Discuss `ControlContainer` (`viewProviders`), `FormArray`, dynamic schema-driven forms, `emitEvent: false`, and Angular's unified `AbstractControl.events` stream."
"Let's go deeper on Angular Signals edge cases: when do you pass a custom `equal` function to `signal()`/`computed()`, how does `linkedSignal`'s `previous` parameter work, what is `afterRenderEffect()`, and how do `viewChildren()`/`contentChildren()` behave reactively?"
"As an Angular specialist interviewing for a broader Frontend Engineering team, how do you objectively compare Angular with React (and frameworks like Next.js)? When would you recommend Angular, and when would you genuinely recommend React instead?"
"How does `@angular/service-worker` work in an Angular PWA? Explain `ngsw-config.json` (`prefetch` vs `lazy` asset groups, `freshness` vs `performance` data groups), handling new app versions gracefully with `SwUpdate`, and common PWA caching pitfalls."
"How do Angular CLI build configurations (`angular.json` `fileReplacements`) compare with the 12-Factor 'Build Once, Deploy Anywhere' pattern? Also, when do custom Angular Schematics or Nx Generators pay off?"
"What are RxJS Schedulers (`queueScheduler`, `asapScheduler`, `asyncScheduler`, `animationFrameScheduler`)? How do they map to the browser's Event Loop, and when do you actually need them in Angular apps or tests?"
"Explain practical frontend use cases for `scan`, `expand`, `pairwise`, and `bufferTime`/`bufferCount` in RxJS. For example, how would you fetch all pages of a cursor-paginated API or batch high-frequency analytics events?"
"How do you write a clean, type-safe custom RxJS operator (pipeable function), and how do you test complex time-based RxJS pipelines using Marble Testing (`TestScheduler`)?"
"Why is `defer()` one of the most underrated creation operators in RxJS? Also explain the exact differences between `EMPTY`, `NEVER`, and `of(undefined)`, and why `finalize()` is critical for loading spinners."
"Your Angular trading dashboard receives 500 WebSocket price ticks per second. Compare `debounceTime`, `throttleTime` (leading vs trailing), `auditTime`, `sampleTime`, and `bufferTime` — which one would you use and why?"
"How would you implement resilient polling in Angular that avoids overlapping requests, automatically pauses when the user switches browser tabs or goes offline, and resumes immediately when they return?"
"In modern RxJS, how does the unified `share()` operator (with `connector`, `resetOnError`, `resetOnComplete`, and `resetOnRefCountZero`) replace legacy multicast operators and solve the 'cached HTTP error' problem of `shareReplay(1)`?"
"When should you use `Map` and `Set` instead of plain Objects and Arrays? Also explain `Symbol`, custom Iterators, Generators (`function*`), and Async Generators (`for await...of`) with a practical frontend use case."
"How do JavaScript `Proxy` and `Reflect` work, and how do libraries/frameworks use them? Also explain Property Descriptors (`writable`, `enumerable`, `configurable`) and the difference between `Object.freeze()` and `Object.seal()`."
"Compare `==`, `===`, and `Object.is()`, explain the difference between Nullish Coalescing (`??`) and Logical OR (`||`), and explain why `0.1 + 0.2 !== 0.3` in JavaScript — and how you handle money accurately on the frontend."
"What are your best practices for structured error handling in TypeScript frontends? Discuss custom `Error` subclasses with ES2022 `Error.cause`, the `Result<T, E>` (Discriminated Union) pattern vs. `try/catch`, and catching global `unhandledrejection` errors."
"Where do Data Structures and Big-O complexity actually matter in real frontend engineering? Discuss eliminating `O(n²)` UI bottlenecks with `Map`/`Set`, traversing tree structures (nested menus/comments/DOM), and how you would build an `O(1)` LRU Cache in TypeScript."
"Why do many senior TypeScript teams avoid `enum` in favor of `as const` objects and union types? Also explain `readonly` tuples, Const Type Parameters (`<const T>`), and when to use Function Overloads vs. Conditional Return Types."
"Explain Template Literal Types, Key Remapping (`as`) inside Mapped Types, and Recursive Types in TypeScript. Give a practical frontend example like strongly typed event names, CSS tokens, or nested i18n dot-notation keys."
"How does TypeScript resolve modules and types? Explain declaration files (`.d.ts`), ambient modules (`declare module`), augmenting global types like `Window`, `import type` with `verbatimModuleSyntax`, and why `moduleResolution: 'bundler'` matters."
"How do you format dates, currencies, numbers, relative times, and locale-aware sorting in modern JavaScript without shipping heavy libraries like Moment.js? Also, what is ReDoS (Catastrophic Backtracking) in Regular Expressions and how do you avoid it?"
"Which classic Software Design Patterns do you actually apply in modern Angular and Frontend applications (e.g., Facade, Strategy, Adapter, Observer, Command, Singleton, Factory)? Give concrete Angular examples instead of textbook UML."
"How do SOLID principles translate pragmatically into Angular and TypeScript? What are the most common Angular code smells you refactor during code reviews?"
"How do modern native browser UI APIs — `<dialog>` (`showModal()`), the Popover API (`popover`), the `inert` attribute, CSS Anchor Positioning, and the async Clipboard API — replace heavy third-party JS modal/tooltip hacks?"
"How does client-side SPA routing actually work under the hood using the Browser History API (`pushState`, `replaceState`, `popstate`)? Explain `PathLocationStrategy` vs. `HashLocationStrategy`, why SPAs return 404 on hard refresh without server config, and `encodeURIComponent` vs. `encodeURI`."
"Suppose a user has your Angular SaaS app open in 5 browser tabs and clicks 'Log Out' (or switches tenant) in Tab 1. How do you synchronize all other tabs immediately? Also explain how to communicate securely with an `<iframe>` using `window.postMessage`."
"How do you implement robust file uploads and downloads in Angular and the browser? Cover `File`, `Blob`, `FormData`, tracking upload progress (`reportProgress`, `HttpEventType`), chunked uploads for large files, and avoiding `URL.createObjectURL()` memory leaks."
"Which modern CSS features help you write cleaner, more resilient, and internationally ready stylesheets without extra JavaScript? Discuss `:has()`, CSS Logical Properties (`margin-inline`, `padding-block`), native CSS Nesting, `aspect-ratio`, and `overscroll-behavior`."
"How do CSS `contain` and `content-visibility: auto` (paired with `contain-intrinsic-size`) speed up rendering of huge pages, and how does the Web Animations API (WAAPI) compare to CSS transitions/keyframes?"
"You're building a live notifications and collaborative status feature over WebSockets in Angular. How do you handle connection lifecycle, zombie connections (heartbeats/ping-pong), exponential backoff reconnection with jitter, state resynchronization after reconnect, and integration with Signals/RxJS?"
"Walk me through what happens from the moment a user enters your Angular app's URL in the browser until the page is interactive — focusing on the Frontend & Network layers: DNS, TCP/TLS handshake, CDN Edge caching, Gzip vs. Brotli compression, TTFB, and HTML/JS bootstrapping."
"Explain the difference between 'Same-Origin' and 'Same-Site' in browser security (and why it matters for cookies and CORS). Also discuss `rel="noopener noreferrer"`, `Referrer-Policy`, `Permissions-Policy`, and cross-origin isolation headers (`COOP`/`COEP`)."
"Explain the differences between Mocks, Stubs, Spies, and Fakes in frontend testing. Also, why has Mock Service Worker (MSW) become so popular for testing and developing Angular/Frontend apps compared to mocking Angular services directly?"
"How do you prevent flaky E2E tests in Playwright/Cypress? Also discuss when Visual Regression Testing and Consumer-Driven Contract Testing (like Pact) add real value to a frontend team."
"Design a production-grade CI/CD pipeline for an Angular application. Cover pipeline stages, PR Preview Environments, Canary/Blue-Green deployments, instant rollbacks, and how you prevent `ChunkLoadError` during zero-downtime static deploys."
"Optimizing a slow Angular app once is easy; keeping it fast across 15 engineers shipping code every day is hard. How do you establish continuous performance governance using Performance Budgets, Lighthouse CI, and RUM dashboards?"
"You need to build an enterprise financial Data Grid in Angular displaying 500,000 transactions with sorting, multi-column filtering, pinned columns, bulk selection, and CSV export. Walk me through the architectural decisions."
"How do you implement Optimistic UI updates safely in Angular (including rollback on error and race-condition handling), support basic offline resilience, and implement an Undo/Redo stack?"
"How do you architect frontend product analytics and telemetry in Angular without scattering vendor calls (`gtag`, `mixpanel`) across 200 components, tanking Core Web Vitals, or violating GDPR/LGPD consent rules?"
"Walk me through how you approach a 45-minute live-coding interview in Angular — for example, building a debounced typeahead search with caching & loading/error states, or a filterable/sortable table with Signals. What structure, edge cases, and communication habits separate Senior candidates?"
"As a Senior Frontend Engineer working remotely across time zones (e.g., Brazil collaborating with US/EU teams), how do you drive complex technical proposals (RFCs/ADRs), break down ambiguous projects, mentor mid/junior developers, and communicate effectively in an async-first English environment?"