Sub topic 4
Inspecting properties, inputs, and outputs
The component tree tells you which components exist. The properties panel tells you what state each one holds. This chapter covers how to read that panel, how its sections map to your class, and which values it can't show you.
This chapter assumes you can already open Angular DevTools and select a component in the Components tab. It also assumes you know @Input/input(), @Output/output(), and signals at a basic level. Editing values is covered in the next chapter, so here you only read.
The properties panel
Select a component in the tree and the right-hand side of the Components tab shows its data. The panel groups values into sections:
- Inputs lists the values the parent bound to the component.
- Outputs lists the events the component can emit.
- Properties lists the other instance fields of the component class.
Directives work the same way. If you select an element that carries a directive, the panel shows that directive's inputs, outputs, and properties too. Newer versions of the extension also list the injectors and providers for the selection. Dependency injection gets its own chapter later.
Here is a small component to practice on.
import { Component, computed, input, output, signal } from '@angular/core';
@Component({
selector: 'app-rating',
standalone: true,
template: `
<p>{{ label() }}</p>
@for (star of stars(); track star) {
<button type="button" (click)="rate(star)">
{{ star <= value() ? '★' : '☆' }}
</button>
}
`,
})
export class RatingComponent {
label = input.required<string>();
max = input(5);
rated = output<number>();
value = signal(0);
stars = computed(() => Array.from({ length: this.max() }, (_, i) => i + 1));
clicks = 0;
rate(n: number): void {
this.clicks++;
this.value.set(n);
this.rated.emit(n);
}
}A parent would use it like this:
<app-rating label="Quality" [max]="7" (rated)="onRated($event)" />Select app-rating in the tree. Inputs should list label and max. Outputs should list rated. Properties should list value, stars, and clicks. Which section a member lands in depends on how you declared it, not on its name or its position in the class.
How class members map to sections
DevTools reads the component instance and the metadata Angular keeps about it. A member is an input or output because Angular's compiled definition says so.
| Declaration | Section | Notes |
|---|---|---|
| `@Input() name` | Inputs | Value is whatever the parent last set. |
| `name = input<string>()` | Inputs | Signal input. Recent versions of the panel show the current value. |
| `@Output() saved = new EventEmitter<T>()` | Outputs | Shows the name, not the emission history. |
| `saved = output<T>()` | Outputs | Same as above. |
| `count = 0`, `items = []` | Properties | Plain instance fields. |
| `value = signal(0)` | Properties | Signal. Recent versions show the current value. |
| `total = computed(...)` | Properties | Derived value, recalculated on read. |
| `get label() { ... }` | Properties | Getters are shown as accessors. See the limits below. |
If a field you expect is missing from Inputs, check the declaration. A plain property that the parent never binds will always appear under Properties, even if the name sounds like an input.
Reading values
Primitive values appear inline. Objects and arrays have an expand arrow, so you can drill into items[3].address.city without writing console code. Large structures are shown lazily. The panel fetches child nodes when you expand them, so a big list does not slow down selection.
A few reading habits save time:
- Compare Inputs with what the parent template says. If the parent binds
[max]="7"and Inputs shows5, the binding is not reaching the component. Typical causes are a typo in the binding name, binding to a different element, or a signal input receivingundefined. - Check Properties for state that should have changed. After you click a star,
valueshould update andclicksshould increment. If neither does, the handler did not run. If onlyclickschanges, the signal update path is wrong. - Look at derived values, not only source values. If
starshas the wrong length, the problem is eithermaxor thecomputed. Inputs tells you which.
You can also pick components from the page instead of the tree. Use the "inspect element" control in the extension and click the UI. This is faster in a large app, because you land on the nearest component. The tree's search box filters by component name.
Outputs: what you can and cannot see
The Outputs section lists the declared output names. It does not log emissions. If you need to know whether rated fired and with what value, subscribe from the console. Select the element in the Elements panel so that $0 points to it, then run this.
const cmp = ng.getComponent($0);
cmp.rated.subscribe((v) => console.log('rated emitted', v));Both output() and EventEmitter have a subscribe method, so the snippet works for either. The subscription lives until the page reloads or the component is destroyed. If you click a star and see no log line, the emit call never ran. If the log appears but the parent did nothing, the problem is in the parent's (rated) handler, and you should select the parent and inspect its properties.
The ng console utilities are covered in detail in a later chapter. Here they only fill the gap that the Outputs list leaves.
Limits of the panel
The panel is a snapshot of an instance, and it has edges you should know about.
- Development mode only. Angular DevTools relies on debug information that production builds strip out. If your app is in production mode, the extension reports that it cannot inspect it.
- Values can lag. The panel refreshes when change detection runs. A component under
OnPushthat has not been marked dirty may show a value that is stale compared with a field you changed in code. This does not mean the field is wrong. Trigger an event or reopen the selection to refresh. - Getters hide cost. A getter is presented as an accessor, and the panel may not evaluate it automatically. Click or expand it to read the value. If the getter does heavy work or has side effects, each read runs that code. Do not expand getters that you do not trust.
- Only serializable shapes display well. Class instances,
Map,Set, DOM nodes, and circular structures may appear as type names or shallow summaries. For those, useconsole.logthroughng.getComponent($0), where the browser's own object viewer can expand them. - Private fields are still visible. TypeScript's
privatekeyword is compile-time only, so those members appear. Fields declared with the#namesyntax are real JavaScript private fields and will not appear. - Template-local state is absent. Variables created with
@letor@foraliases, and template reference variables, belong to the template, not to the class instance. They will not show under Properties.
Debugging a wrong-looking value
A common situation: the UI shows seven star buttons for a rating component that should show five. A systematic pass with the panel looks like this.
- Select the component in the tree or with the inspect control.
- Read Inputs.
maxshows7. So the component is receiving what the parent sent, and the component's logic is probably fine. - Select the parent component. Read its Properties. If the parent holds
ratingMax = 7, the data is wrong at the source. If it holds5, the binding uses another expression, so check the parent's template. - If both look correct, check whether another instance of the component is on the page. The tree shows each instance as its own node, and each has its own values.
That sequence moves from the symptom to the owner of the data in a few clicks. It works because Inputs separates "what I was given" from "what I computed", which a console.log inside the class does not do for you.
Summary of the workflow
- Use Inputs to verify what a parent delivered.
- Use Properties to verify internal state and derived signals.
- Use Outputs to confirm what an event is called, then subscribe from the console to watch emissions.
- Treat the panel as a view of the current instance, in development mode only, and remember that getters and exotic objects need care.
Exercise
A parent template contains <app-rating label="Quality" [max]="limit" />. In DevTools, the Inputs section of app-rating shows max: 5, but you expected 10. Which component should you select next, and what do you look for?
Show answer
Select the parent component and read its Properties. Look at limit. If limit is 10, the binding is not reaching the child, so check the template for typos or a second app-rating instance. If limit is 5, the data is wrong in the parent, and you trace where limit is assigned.
Exercise
You click a star, the clicks property increments, but the parent's (rated) handler does nothing. The Outputs section lists rated. How do you find out whether the output emitted, and what does each result tell you?
Show answer
Select the element so $0 refers to it, then run ng.getComponent($0).rated.subscribe(v => console.log(v)) and click again. If a log line appears, the component emitted and the fault is in the parent's binding or handler. If nothing logs, emit was never called, so the fault is inside the component's rate method or its click binding.