Angular · Junior · Question 3 of 75
What does the @Component decorator describe?
@Component({
selector: "app-user-card",
template: `<h2>{{ name }}</h2>`,
styles: `h2 { color: teal; }`,
})
export class UserCard {
name = "Ann";
}- ✓Correct answer: Component metadata: the CSS selector, template and styles of the class
- 2A route that renders the component at the
/app-user-cardURL - 3A service that the component exposes to other components
Explanation
The decorator turns a plain TypeScript class into a component. selector is the tag you use in other templates (<app-user-card />), template/templateUrl is the markup, styles/styleUrl are the scoped styles.