Advertisement

Information Technology

Angular Interview Questions & Answers

The Angular front-end framework.

42topics 210questions last updated
Advertisement

Accessibility (a11y) in Angular

All 5 questions
  1. Accessibility means building an app that everyone can use, including people who use screen readers, keyboards only, or have vision or motor difficulties. In Angular this means usin…

  2. The Angular CDK includes a dedicated a11y package with tools like FocusTrap, which keeps keyboard focus inside a dialog while it is open, and LiveAnnouncer, which lets you announce…

  3. You bind ARIA attributes directly in the component template using Angular's attribute binding syntax, describing the role and current state of a custom element so a screen reader c…

  4. When a modal opens, focus should move into the modal automatically, and it should stay trapped inside the modal while it is open so a keyboard user cannot accidentally tab to conte…

  5. The Angular ESLint plugin can catch some accessibility mistakes right inside your code editor while you type. The axe DevTools browser extension and Lighthouse in Chrome scan a run…

Angular Animations

All 5 questions
  1. The Angular animations module lets you define smooth transitions between different states of an element, such as fading in or sliding a panel into view. You enable it by importing…

  2. You define an animation trigger with a name, describe the styles for each state using the state function, and describe how to move between those states using the transition functio…

  3. Angular provides special animation functions like query and stagger that let you detect when elements enter or leave a list, and animate each one, such as sliding it out smoothly,…

  4. You can attach an animation trigger to the element that wraps your router outlet, then use special selectors to detect when a new route enters and the old route leaves, letting you…

  5. You can combine a simple Angular animation trigger with a state that responds to a boolean flag toggled by a mouseenter and mouseleave event, or more simply use plain CSS transitio…

Angular CDK (Component Dev Kit)

All 5 questions
  1. The Angular CDK, short for Component Dev Kit, provides behavior and utilities for building custom components, such as overlays, drag and drop, and accessibility helpers, without an…

  2. The CDK Drag and Drop module provides directives that let you make any element draggable and any container a valid drop zone, handling the complex logic of tracking drag position,…

  3. The Overlay service creates a floating container attached to the page independent of the normal component layout, letting you position content precisely relative to a trigger eleme…

  4. Virtual scrolling only renders the items currently visible on screen, plus a small buffer, instead of rendering every single item in a very long list at once. This keeps the page f…

  5. The CDK Layout module provides tools for detecting the current screen size and responding to changes, such as switching between a mobile and desktop layout, using a simple observab…

Angular CLI & Project Structure

All 5 questions
  1. The Angular CLI is a command line tool that helps you create, build, test, and manage an Angular project without setting up complicated build tools yourself. Running a single comma…

  2. The angular.json file holds the configuration for how your project is built, tested, and served, including things like which files to include in the build, environment specific set…

  3. The CLI provides generate commands, often shortened to g, that create new files following Angular's recommended structure and naming conventions automatically, saving you from manu…

  4. The src folder contains your actual application code, with an app folder holding your components, services, and other feature code. An assets folder holds images and static files,…

  5. Running ng build with the production configuration creates an optimized version of your app with smaller file sizes, and tools like the source-map-explorer package let you visualiz…

Angular DevTools & Debugging

All 5 questions
  1. Angular DevTools is a free browser extension for Chrome and Firefox that adds new tabs to your browser's developer tools, letting you inspect your app's component tree, view curren…

  2. The Profiler tab lets you record a session while interacting with your app, then shows a visual chart of exactly how long each component took during every change detection cycle, m…

  3. Common causes include mutating an array or object directly instead of creating a new one when using the OnPush change detection strategy, since Angular only checks for a new refere…

  4. Angular's development build includes source maps, which map the compiled JavaScript back to your original TypeScript files, letting you set breakpoints directly in your real source…

  5. Read the error message carefully from top to bottom, since Angular error messages usually include the exact component name and often a helpful stack trace showing where the problem…

Angular Elements (Web Components)

All 5 questions
  1. Angular Elements let you package an Angular component as a standard web component, called a custom element, which can then be used inside any web page or framework, such as plain H…

  2. You can pass data into an Angular Element using regular HTML attributes, which map to the component's inputs, and Angular Elements automatically converts these attribute values int…

  3. You configure your build to produce a single JavaScript file containing your component along with all of Angular's necessary runtime code, then any website can simply include that…

  4. Angular Elements are best suited for embedding one specific, self contained piece of functionality, like a widget or a small form, into another page or application. A full micro fr…

  5. Imagine a company wants to offer the exact same interactive product configurator on their own Angular based website and also as an embeddable widget on partner websites built with…

Angular Material & UI Component Libraries

All 5 questions
  1. Angular Material is an official component library built by the Angular team, providing ready to use, well tested, and accessible components like buttons, dialogs, and date pickers…

  2. You inject the MatDialog service into your component, and call its open method with the component you want to display inside the dialog. The dialog handles showing itself, dimming…

  3. Angular Material's table component works together with a data source, and you define which columns to display using column definitions in your template, giving you a fully function…

  4. You implement the MatFormFieldControl interface on your custom component, providing the required properties and methods Angular Material expects, letting your custom input work sea…

  5. Other widely used options include PrimeNG, which offers a very large collection of components and several visual themes, and Ng Bootstrap, which brings Bootstrap's popular design s…

Angular Material Theming

All 5 questions
  1. A theme defines the colors, typography, and density used across every Angular Material component in your app. You either use one of the prebuilt themes that ship with Angular Mater…

  2. You define color palettes using Material's color definition functions, choosing specific colors for your primary and accent roles, then pass these into your theme definition, which…

  3. You define two separate theme classes, one for light mode and one for dark mode, and toggle a CSS class on your app's root element based on the user's chosen preference. Angular Ma…

  4. Density controls how compact or spacious Material components appear, letting you shrink padding and sizing across buttons, form fields, and other components uniformly, which is use…

  5. Material 3, Google's newer design system, introduces a more flexible color system based on a single seed color that automatically generates a full, harmonious palette, along with u…

Angular Schematics & Custom Builders

All 5 questions
  1. A schematic is a template based code generator that the Angular CLI uses to create new files, such as components and services, following consistent naming and structure rules. Ever…

  2. You create a new schematic project using the Angular schematics CLI tools, define a rule function that describes what files to create and how to transform them, and package it as a…

  3. A schematic generates or modifies source code files, while a builder actually performs a task using your project's code, such as building it for production, running tests, or deplo…

  4. Running ng update with the Angular package name automatically applies migration schematics that update your code to match breaking changes in the new version, such as renaming APIs…

  5. Creating internal schematics helps a company enforce consistent code patterns, folder structures, and best practices automatically across many different teams and projects, reducin…

Angular Security (XSS, Sanitization & CSP)

All 5 questions
  1. Cross site scripting happens when an attacker manages to inject malicious code into a page, which then runs in another user's browser, often stealing information or performing unwa…

  2. The DomSanitizer service lets you explicitly mark a value as safe to use in a specific context, like HTML, a URL, or a style, bypassing Angular's default automatic sanitization. It…

  3. You use a trusted sanitization library, like DOMPurify, to clean the HTML first, removing any dangerous scripts or unsafe attributes, before ever marking the result as trusted usin…

  4. A Content Security Policy is a set of rules, usually sent as an HTTP header from the server, that tells the browser exactly which sources of scripts, styles, and other content are…

  5. Data kept in local storage remains accessible to any JavaScript running on the page, meaning a successful cross site scripting attack could potentially read and steal that token. S…

Angular Signals

All 5 questions
  1. A signal is a wrapper around a value that notifies Angular exactly when that value changes, letting Angular update only the specific parts of the page that actually depend on it. Y…

  2. A computed signal derives its value from one or more other signals, and Angular automatically tracks which signals it reads, recalculating the computed value only when one of those…

  3. The effect function lets you run a piece of code automatically whenever any signal it reads inside changes, similar to how a computed signal works, but instead of producing a new v…

  4. Signal inputs let a component receive data from its parent as a signal instead of a plain property, using the input function. This means the component can react to changes just lik…

  5. Signals provide a simpler way to manage values that change over time for many common cases, without needing to understand the broader concepts of RxJS, like subscribing and unsubsc…

Angular Style Guide & Best Practices

All 5 questions
  1. The official Angular style guide provides recommended conventions for naming files, organizing folders, and structuring components and services consistently. Following it helps a t…

  2. The single responsibility principle means each component or service should do just one clear thing, such as displaying a single piece of information or handling one specific type o…

  3. OnPush tells Angular to only check a component for changes when its inputs actually change by reference, or when an event happens inside it, rather than checking it on every single…

  4. Common recommendations include organizing code by feature rather than by file type, keeping shared, reusable code in a dedicated shared module or folder, lazy loading feature areas…

  5. Small, focused components are easier to understand at a glance, easier to test in isolation, and easier to reuse in different parts of an app. A very large component that handles t…

Build, Environments & Deployment

All 5 questions
  1. Running ng build with the production configuration creates an optimized version of your app, with smaller file sizes and development warnings removed, ready to be uploaded to a rea…

  2. Angular projects typically include separate environment files, such as environment.ts for development and environment.prod.ts for production, each exporting the same variable names…

  3. Firebase Hosting and Netlify are popular choices that make deploying a built Angular app quick and simple, often connecting directly to your code repository and automatically deplo…

  4. A continuous deployment pipeline automatically runs your tests, builds your app, and deploys it to a live server every time new code is pushed to your repository, without anyone ne…

  5. A bundle size budget warns or fails the build if your app's JavaScript files grow beyond a specified size, helping the team catch accidental bloat, such as an unnecessarily large l…

Change Detection

All 5 questions
  1. Change detection is the process Angular uses to check whether any data used in a component's template has changed, and if so, update the actual page to reflect the new values. It r…

  2. The Default strategy checks every component in the app on every change detection cycle, regardless of whether its data actually changed. The OnPush strategy only checks a component…

  3. With OnPush, Angular only checks whether an input's reference has changed, not whether its internal contents have changed. Directly mutating an existing array or object keeps the s…

  4. Traditional Angular relies on Zone.js to automatically detect when something might have changed, such as after any asynchronous operation, then checks the entire app just in case.…

  5. You can inject the ChangeDetectorRef service and call its detectChanges or markForCheck method to tell Angular to check a specific component, which is sometimes necessary when a va…

Components & Templates

All 5 questions
  1. A component is a reusable piece of the user interface, combining a TypeScript class that holds data and logic, an HTML template that describes what appears on screen, and optionall…

  2. You use double curly braces, called interpolation, to display the value of a property directly inside your HTML template. Angular automatically keeps this displayed value in sync w…

  3. Standalone components declare their own dependencies, like which directives or other components they use, directly within the component itself using the imports array, removing the…

  4. Newer versions of Angular provide the at if block, a built in control flow syntax that lets you show or hide content based on a condition directly in your template, replacing the o…

  5. You mark a class property with the Input decorator, or use the newer input function, letting a parent component pass a value down through an attribute in the template, which the ch…

Content Projection (ng-content)

All 5 questions
  1. Content projection lets a component accept and display content passed in by whatever uses it, similar to how a picture frame can hold any picture you place inside it. You add an ng…

  2. You add a select attribute to each ng-content tag, matching a specific CSS selector, letting content marked with a matching attribute or class be projected into that exact slot, ra…

  3. ng-template defines a piece of template content that is not rendered immediately by default, and a component can accept it as an input, deciding exactly when and how to render it,…

  4. You can use the ContentChild decorator to get a reference to projected content, and check whether it exists after the view has initialized, letting you conditionally render fallbac…

  5. A reusable alert box component can use content projection to display any message passed into it, whether that message is plain text, a link, or even another small component, withou…

Data Binding

All 5 questions
  1. Angular supports interpolation for displaying a value in text, property binding for setting an element's property, event binding for responding to user actions, and two way binding…

  2. You wrap an event name in parentheses inside your template, and set it equal to a method on your component class, which Angular calls automatically whenever that specific event, li…

  3. Two way binding is really a combination of a property binding and an event binding happening together. The square brackets set the input's value from your component's property, whi…

  4. You define a regular Input property and a matching Output property whose name is the input's name followed by the word Change, emitting the new value whenever it changes. Angular t…

  5. Property binding sets a property directly on the underlying DOM element object, which works for most common cases. Attribute binding, using the attr prefix, is needed specifically…

Dependency Injection Providers & Injection Tokens

All 5 questions
  1. A provider tells Angular's dependency injection system how to create a specific value or service when something asks for it. Most commonly this is just the class itself, but a prov…

  2. An injection token is used when you want to inject something that is not a class, such as a plain configuration object or a primitive value, since Angular's dependency injection no…

  3. The useFactory option lets you provide a function that Angular calls to create the actual value, rather than just instantiating a class directly, useful when creating a service req…

  4. useClass tells Angular to create a brand new instance of a different class when something asks for the original one, useful for swapping implementations, such as during testing. us…

  5. Setting providedIn to root tells Angular to make this service available application wide, using a single shared instance, without needing to manually list it in any component's or…

  1. A directive is a class that adds behavior to an element in your template. Component directives are directives with their own template. Structural directives, like the older asteris…

  2. You create a class decorated with the Directive decorator, specifying a selector that matches the attribute you want to use in templates, then use dependency injection to get a ref…

  3. HostListener lets you attach an event listener directly to the element a directive is applied to, without needing to manually add event bindings in a template, making it useful for…

  4. You inject a TemplateRef, representing the content the directive is applied to, and a ViewContainerRef, representing where that content can be inserted, then use createEmbeddedView…

  5. ngFor, and its newer replacement the at for control flow block, repeats a piece of template content once for every item in a list, letting you display a collection of data such as…

End to End Testing with Cypress & Playwright

All 5 questions
  1. End to end testing runs your actual app in a real browser and simulates a real user's actions, like clicking buttons and filling out forms, checking that entire flows work correctl…

  2. You install Cypress as a development dependency, run its setup command to generate a starter configuration, then write test files describing the user flows you want to verify, such…

  3. Playwright is another popular end to end testing tool, notable for supporting multiple browsers, including Chrome, Firefox, and Safari, from a single test suite, and for generally…

  4. Both Cypress and Playwright let you intercept outgoing network requests and respond with fake data instead of letting the request actually reach a real server, making tests faster,…

  5. Unit tests are fast and pinpoint exactly which small piece of code broke, but cannot catch problems that only appear when pieces are combined together, like a broken navigation flo…

  1. Template driven forms build the form structure mostly in the HTML template, using ngModel for two way binding and letting Angular create the form control objects behind the scenes…

  2. You pass one or more validator functions, like Validators.required, when creating a FormControl, and check the control's valid and touched properties in your template to decide whe…

  3. You use a FormArray, which holds a dynamic list of form controls, letting you add or remove entries at runtime, such as letting a user add as many phone numbers as they need, while…

  4. An asynchronous validator function returns an observable or a promise instead of a plain value, letting you perform something like an API call to check availability, with Angular a…

  5. You bind to the form's ngSubmit event instead of the native submit event, and Angular automatically prevents the default page reload behavior for you, letting your component's own…

HTTP Client & Interceptors

All 5 questions
  1. You inject the HttpClient service into your component or service, and call its get method with the target URL, which returns an observable that emits the response once the request…

  2. An interceptor lets you intercept every outgoing HTTP request and incoming response, allowing you to modify them consistently in one central place, such as automatically adding an…

  3. You use the catchError operator inside the observable's pipe, letting you catch any error the request throws, log it if needed, and return a fallback value or rethrow a more user f…

  4. You combine an interceptor with RxJS's retry operator, which automatically resubscribes to a failed request a specified number of times, useful for handling brief, temporary networ…

  5. You call the post method on HttpClient, passing the target URL and the data you want to send as the request body, which Angular automatically converts to JSON by default, and it re…

Internationalization (i18n) in Angular

All 5 questions
  1. Internationalization, often shortened to i18n, means building an app so it can easily show text in different languages for different users around the world. Angular provides a buil…

  2. Unlike Angular's built in i18n, which requires a separate build for each language, ngx-translate loads translation files at runtime and lets a user switch languages instantly witho…

  3. Angular's i18n system provides an ICU expression syntax specifically for plurals, letting you define separate translations for different count ranges directly inside your template,…

  4. Angular provides built in pipes, like date, number, and currency, that automatically format values according to the active locale, showing dates, decimal separators, and currency s…

  5. With a runtime translation approach like ngx-translate, you store the currently selected language and call the service's use method whenever the user picks a new option, letting al…

Lifecycle Hooks

All 5 questions
  1. Lifecycle hooks are special methods Angular calls automatically at specific points in a component's life, such as right after it is created or right before it is destroyed, letting…

  2. ngOnDestroy runs right before Angular removes a component from the page, giving you a chance to clean up anything that would otherwise keep running unnecessarily, such as unsubscri…

  3. ngOnChanges runs whenever one of a component's input properties changes, including the very first time it receives a value, and it receives an object describing exactly what change…

  4. Angular calls them in a predictable sequence: ngOnChanges first if there are any inputs, then ngOnInit once, followed by ngDoCheck, ngAfterContentInit, ngAfterContentChecked, ngAft…

  5. The constructor's main job is simply setting up dependency injection, and at that point Angular has not yet fully set up the component's inputs or view. Fetching data or performing…

Micro Frontends with Angular

All 5 questions
  1. A micro frontend architecture splits a large web application into several smaller, independently developed and deployed applications, often owned by separate teams, that are then c…

  2. Module Federation lets one application expose specific modules, and another completely separate application load and use those modules directly at runtime, without needing both to…

  3. Common strategies include a shell application that dynamically loads other applications at runtime, often using Module Federation, using web components like Angular Elements to emb…

  4. Common challenges include keeping a consistent design and user experience across independently built pieces, managing shared state between separate applications that do not natural…

  5. For smaller applications or teams, a micro frontend architecture adds significant operational complexity, like managing multiple deployments, shared dependency versions, and cross…

New Control Flow Syntax (@if, @for & @switch)

All 5 questions
  1. The at if block is a newer, built in template syntax for conditionally showing content, reading more like a regular programming language conditional than the older asterisk ngIf st…

  2. The at for block repeats a piece of template content for every item in a list, similar to the older ngFor directive, but it requires a track expression, telling Angular exactly how…

  3. The at switch block lets you check a single value against several possible cases, rendering different content for each matching case, similar to a switch statement in regular progr…

  4. Because the new syntax is built directly into Angular's template compiler rather than relying on separate directive classes, Angular can generate more efficient instructions during…

  5. Angular provides a CLI schematic that automatically scans your templates and converts the older structural directive syntax to the new at if and at for blocks, handling the common…

NgModules & Modular Architecture

All 5 questions
  1. An NgModule is a class decorated with the NgModule decorator that groups together related components, directives, pipes, and services, declaring what belongs together and what that…

  2. A feature module groups together everything related to one specific area of functionality, such as an orders feature or a user settings feature, keeping that area's components, ser…

  3. You configure the router to load a module using loadChildren with a dynamic import statement, rather than directly importing and declaring the module upfront, telling Angular to on…

  4. Standalone components remove a significant amount of boilerplate, since each component explicitly declares its own dependencies directly rather than needing to be registered inside…

  5. A SharedModule traditionally grouped together commonly reused components, directives, and pipes that many different feature modules needed, avoiding the need to import each one ind…

NgRx State Management

All 5 questions
  1. NgRx is a state management library for Angular, inspired by Redux, that keeps all of an app's shared state in one single central store. The only way to change that state is by disp…

  2. You use a selector function, created with createSelector, to describe exactly which piece of state you want, then inject the Store service and call its select method with that sele…

  3. An Effect listens for a specific action, performs an asynchronous operation like an HTTP request, and then dispatches a new action once that operation completes, keeping asynchrono…

  4. NgRx Entity provides a standard, normalized way to store collections of similar items, keyed by their unique id, along with prebuilt functions for common operations like adding, up…

  5. For small to medium apps, a simple service combined with signals is often perfectly sufficient and much easier to learn. NgRx becomes valuable for very large apps with complex, fre…

Performance & Lazy Loading

All 5 questions
  1. Lazy loading means only downloading the code for a specific feature or route when the user actually navigates to it, instead of including everything in the app's initial bundle. Th…

  2. OnPush tells Angular to only check a component when its inputs change by reference, an event happens inside it, or an observable it depends on emits, rather than checking it on eve…

  3. The at defer block lets you delay loading and rendering a piece of a template until a specific trigger happens, such as the element becoming visible on screen, the user interacting…

  4. Without a tracking expression, Angular assumes every item in a list might be a completely different one whenever the list reference changes, potentially destroying and recreating e…

  5. You build your app for production and use a bundle analysis tool, like source-map-explorer, to visualize exactly which packages and files are taking up the most space, helping you…

Pipes (Built-in & Custom)

All 5 questions
  1. A pipe transforms a value directly inside your template for display purposes, without needing to write that transformation logic inside your component class. You apply a pipe using…

  2. Angular provides several useful built in pipes, including date for formatting dates, uppercase and lowercase for changing text casing, currency and number for formatting numeric va…

  3. You create a class decorated with the Pipe decorator, specifying a name to use in templates, and implement a transform method that receives the input value and any arguments, retur…

  4. A pure pipe, the default type, only recalculates its output when its actual input value changes by reference, making it very efficient. An impure pipe recalculates on every single…

  5. The async pipe automatically subscribes to an observable or promise, displays its most recently emitted value, and automatically unsubscribes when the component is destroyed, savin…

Progressive Web Apps (PWA) with Angular

All 5 questions
  1. A Progressive Web App is a website that behaves more like a native app, capable of working offline, being installed on a device's home screen, and loading quickly even on unreliabl…

  2. A service worker is a script that runs separately from your app in the background, intercepting network requests and deciding whether to serve a cached response or fetch a fresh on…

  3. The manifest.webmanifest file describes metadata about your app, such as its name, icons, theme color, and how it should appear when installed on a device's home screen, letting br…

  4. Angular's SwUpdate service lets you subscribe to version update events, detecting when the service worker has downloaded a new version of the app in the background, letting you sho…

  5. A Progressive Web App can be built and maintained as a single codebase, deployed instantly through a normal website deployment rather than through app store approval processes, and…

Router Guards & Resolvers

All 5 questions
  1. A route guard is a function that runs before a route is activated, deciding whether navigation should be allowed to continue, redirected elsewhere, or blocked entirely. A very comm…

  2. The canDeactivate guard runs before a user navigates away from a route, letting you check whether it is actually safe to leave, such as prompting the user to confirm if they have u…

  3. A resolver fetches data before a route actually activates, ensuring the component already has the data it needs the moment it appears on screen, rather than showing an empty or loa…

  4. You list several guard functions in the canActivate array for a route, and Angular runs them in order, only allowing navigation to proceed if every single guard returns true, letti…

  5. Fetching data inside ngOnInit means the component renders first, often showing a brief loading state, before the data actually arrives. A resolver instead delays the route's naviga…

  1. Client side routing lets a user navigate between different pages, called views, of a single page app without the browser actually reloading the page from the server every single ti…

  2. Instead of a regular HTML anchor tag, which would cause a full page reload, Angular provides the routerLink directive that changes the current page smoothly using client side routi…

  3. You define a route with a colon before a parameter name, like colon id, and inject the ActivatedRoute service to access that specific value from the current web address inside your…

  4. You nest a children array inside a parent route definition, and place a router outlet inside the parent component's template, letting the parent's own layout, like a shared sidebar…

  5. You inject the Router service and call its navigate method with the path you want to go to, useful right after a successful form submission or login, without relying on the user cl…

RxJS & Observables

All 5 questions
  1. An observable represents a stream of values that can arrive over time, and you subscribe to it to receive those values as they happen. Unlike a promise, which resolves with exactly…

  2. map transforms each emitted value into something else, similar to the array method of the same name. filter only lets through values matching a specific condition. switchMap is use…

  3. A plain Subject only emits values to subscribers that are already subscribed at the moment a value is sent, missing anything emitted before they subscribed. A BehaviorSubject alway…

  4. The combineLatest operator lets you combine the most recent values from several observables into a single observable, emitting a new combined value whenever any one of the source o…

  5. Forgetting to unsubscribe from a long lived observable, such as one tied to a manually created subscription, can cause a memory leak, since the subscription and anything it referen…

Server-Side Rendering with Angular Universal

All 5 questions
  1. Server side rendering means generating the full HTML for a page on the server before sending it to the browser, instead of sending an almost empty page and building everything with…

  2. Hydration is the process where Angular takes the already rendered HTML sent from the server and attaches the necessary behavior to it in the browser, making buttons clickable and i…

  3. You use Angular's TransferState feature together with your normal data fetching services, letting data fetched during server rendering be passed along to the browser, so the client…

  4. APIs that only exist in a browser, like window, document, or localStorage, are not available in the Node.js environment used for server rendering, and accessing them directly will…

  5. Server side rendering improves how quickly visitors see meaningful content, since the browser receives already built HTML instead of an empty shell. It also improves how well searc…

Services & Dependency Injection

All 5 questions
  1. A service is a class dedicated to a specific piece of functionality, such as fetching data from a server or managing shared application state, kept separate from components so that…

  2. Dependency injection means a component or another service does not create its own dependencies directly, but instead receives them automatically, usually through its constructor, f…

  3. The inject function lets you request a dependency directly inside a property initializer or a function, rather than only inside a constructor, which can make code more concise, esp…

  4. Angular's injector system is hierarchical, meaning a service provided inside a specific component's providers array creates a new, separate instance just for that component and its…

  5. You provide a fake, simplified version of the service in your test's configuration, replacing the real one, letting you control exactly what data or behavior the component receives…

Standalone Components

All 5 questions
  1. A standalone component declares its own dependencies, like which other components or directives it uses, directly within itself using an imports array, without needing to be regist…

  2. You call bootstrapApplication with your root standalone component, and provide any application wide services or configuration directly as providers, completely skipping the traditi…

  3. Instead of lazy loading an entire feature module, you can lazy load a single standalone component directly in your route configuration using loadComponent, letting you split your a…

  4. Angular provides an official CLI schematic that automatically analyzes your existing NgModules and converts your components, directives, and pipes to standalone versions, updating…

  5. Because each standalone component explicitly lists exactly what it depends on, Angular's build tools can more easily determine which code is actually used and safely remove anythin…

State Management

All 5 questions
  1. State management refers to how an app organizes and shares data that changes over time, such as the current logged in user, items in a shopping cart, or a form's values. Small apps…

  2. Signals let you read and update a value directly and synchronously, without needing to subscribe or manage a subscription's lifecycle, making many common state management scenarios…

  3. A simple signal based service works well for most small to medium apps, especially with straightforward shared state. NgRx becomes valuable for very large apps with complex, freque…

  4. Normalized state stores related data, like users and their posts, as separate flat collections referenced by id, instead of deeply nesting one inside the other. This avoids duplica…

  5. If the same piece of data needs to be passed through many layers of components that do not actually use it themselves, often called prop drilling, or if unrelated parts of an app f…

Template Reference Variables & ViewChild

All 5 questions
  1. A template reference variable, created with a hash symbol directly in your template, gives you a way to refer to a DOM element or a component instance from elsewhere within that sa…

  2. ViewChild lets a parent component get a direct reference to a child component or a DOM element within its own template, from inside the parent's TypeScript class, letting the paren…

  3. The viewChild function returns a signal instead of a plain property, letting you read the referenced element or component reactively, and it can be marked as required, causing a cl…

  4. ViewChildren returns a QueryList containing every matching element or component instance found in the parent's template, which you can iterate over like an array, and it automatica…

  5. ViewChild accesses an element or component that is part of a component's own template, defined directly by that component. ContentChild accesses an element or component that was pr…

Testing with Jasmine & Karma

All 5 questions
  1. Jasmine is a testing framework that provides the actual syntax for writing tests, like describe and it blocks and expect assertions. Karma is a test runner that executes those test…

  2. TestBed lets you configure a testing module specifically for your test, providing either the real service or a mock version, then create an instance of your component within that c…

  3. You find the button element in the rendered component's DOM, simulate a click event on it using dispatchEvent, run change detection to let Angular process the resulting update, and…

  4. You use Angular's HttpClientTestingModule and the HttpTestingController, which let you intercept outgoing requests during a test, verify the exact request was made correctly, and m…

  5. A unit test checks a small, isolated piece of logic, like a single function or service method, completely on its own, often without needing Angular's TestBed at all. A component te…

TypeScript with Angular

All 5 questions
  1. TypeScript adds type checking to JavaScript, catching many common mistakes, like passing the wrong kind of value to a component, before the code even runs, right inside your code e…

  2. TypeScript usually figures out the correct type automatically based on the initial value you give the signal function, but you can also specify the type explicitly inside angle bra…

  3. You define an interface describing the exact shape of the expected data, and use it as the generic type parameter when calling HttpClient methods, letting TypeScript check that you…

  4. TypeScript generics let a component's input types adapt to whatever specific data type is actually passed in, letting you write one flexible list component that works correctly and…

  5. Strict mode enables a stricter set of TypeScript checks, such as disallowing implicit any types and requiring null checks before using a potentially null value, catching more poten…

Zoneless Change Detection & Zone.js

All 5 questions
  1. Zone.js is a library that Angular has historically relied on to automatically detect when something in your application might have changed, such as after a click event, a timer, or…

  2. Zoneless change detection removes Zone.js entirely and instead relies on more explicit and precise signals, like Angular Signals, to tell Angular exactly which parts of the applica…

  3. Removing Zone.js reduces the amount of JavaScript the browser needs to download and parse, avoids the overhead of patching many browser APIs, and generally leads to faster startup…

  4. You gradually convert components to use signals instead of plain class properties for reactive state, replace manual change detection triggers where needed, verify that any third p…

  5. Zoneless change detection makes Angular apps faster and lighter by removing the need to patch and monitor every possible browser event, while also making it easier to debug because…