Selector property
A selector property is component or directive metadata specifying the element, attribute, or pattern that identifies where it applies in a template.
Pro Angular 16
An Angular directive selector is metadata that specifies which elements or attributes cause a directive to be applied.
- How it is used
- Identifies the host elements on which Angular applies components or directives.
- How deep it goes
- Explains selector-to-host matching through component setup and a directive change, without detailing selector parsing.
- Examples
- Shows `app-root` and `app` hosts, nested form and table components, and a `td[paApplyColor]` directive selector.
- What you can do after
- Operate/configure it by matching a selector to an HTML host or changing a selector to prevent a directive from applying.
Essential TypeScript 5, Third Edition
A selector property is Angular component metadata that specifies the element or attribute pattern identifying where the component is used in a template.
- How it is used
- Identifies component locations in HTML and enables Angular to compose nested application views.
- How deep it goes
- Defines CSS-selector matching and follows resolution through nested templates, but stops short of selector syntax variations.
- Examples
- Uses product-item, product-list, header, and category-list elements in product-list.component.html and app.component.html.
- What you can do after
- Apply it via Angular by assigning a selector and placing the matching element in a declared component template.
Read how Essential TypeScript 5, Third Edition explains selector property →
Related concepts
- Angular componentconfigures · An Angular component is a class with metadata and a template that defines a view and its associated behavior in an Angular application.
- component decoratorpart of · A component decorator is an annotation or decorator that attaches metadata to a class or other program element to identify or configure it as a framework component.
- root componentpart of · A root component is the topmost component in an application’s component hierarchy, responsible for rendering or managing the root interface.
- componentconfigures · A software component is a modular part of a larger system that provides related functionality and interacts with other parts through defined boundaries or interfaces.
- CSS selectoruses · A CSS selector is a pattern that identifies document elements by their names, attributes, relationships, states, or other conditions.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

