Components and templates
What does a component contain?
A TypeScript class, an HTML template and component metadata connect behavior to the view. A standalone component lists the components, directives and pipes its template uses in imports. Importing a TypeScript symbol alone doesn’t make it available in the template. Follow-up: remove a template dependency and explain the compiler diagnostic.
Signals and derived state
How do signal and computed differ? A writable signal stores a value; a computed signal derives a read-only value from signals it reads. Read either by calling it. Use set or update on writable state. Follow-up: change both quantity and price, and show that a computed total follows both without a second writable total to synchronize.
Lists and component boundaries
Why does @for need track? It identifies rows so Angular can associate data with DOM elements. Prefer a stable identifier when rows can be inserted, removed or reordered. An index is appropriate for a static collection. Follow-up: reorder two editable rows and check that each value stays with its record.
How do inputs and outputs differ? Inputs carry data into a component; outputs notify a listener.
An input signal is read-only in the receiving component.
An output isn’t a bubbling DOM event. Follow-up: send an item’s ID to its parent and update the selected state there.
Services and dependency injection
Does an injected service always have one instance? Its provider and injector hierarchy determine where instances are shared. A root-provided service and a component-provided service can have different lifetimes and sharing. Follow-up: create two component instances with component-level providers and show whether a change in one affects the other. Explain the intended state ownership before choosing a scope.
Routing
Why can a detail page render the wrong component? Route order matters; a broad match can capture a URL before a specific route. Put the wildcard fallback last. Also distinguish a path parameter from a query parameter. Follow-up: test a known detail URL, an unknown URL and navigation to a second record without relying on a full page reload.
Form models and validation
When would you use reactive forms? They give explicit control models, useful for validation and dynamic form structure. Template-driven forms build their model through template directives and suit simpler forms. Follow-up: prove that 0 is a valid quantity while an empty required name is invalid. A disabled button alone doesn’t prove the submission handler respects validity.
HTTP and RxJS
Does http.get<Order>() validate the server’s JSON? The generic describes the expected TypeScript shape; it doesn’t inspect the payload at runtime. Validate untrusted data when the application needs that guarantee. Each subscription to a request Observable can send a new request. Follow-up: explain why two independent subscriptions can produce two network calls.
When should signals and RxJS be used together? Signals represent values the view reads; Observable operators can describe asynchronous streams. toSignal bridges an Observable to a signal and subscribes immediately. Reuse the created signal instead of calling it repeatedly for the same stream. Follow-up: make a later search supersede an earlier request, then recover from an error without losing future searches.
Testing and interview evidence
What should a component test assert? Render the component, perform a user action and inspect the resulting behavior. Angular’s testing tools include TestBed; new CLI projects use Vitest by default, while the documentation still covers Karma for existing setups. A test of a method alone doesn’t prove its template binding works.
For a senior follow-up, replace a service with a controlled test provider and make its response fail. Verify the error display and a successful retry. The Angular exercises give concrete failure cases. Use the Angular course for checked implementation work, and the Angular versus React guide to compare component and state models. These are practice questions, not a prediction of an employer’s interview.