February 2019
Beginner
694 pages
18h 4m
English
Angular uses a class decorator named @Component to specify that a class can act as an HTML component. Let's take a closer look at this decorator:
import { Component } from '@angular/core';
// existing ClickableItem code
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
... existing code
}
This code starts with an import statement to define the Component decorator from a library named '@angular/core'. This import statement is part of the modular syntax that we will cover in a later chapter, and gives us the ability to easily reference other classes from the Angular framework. The Component module that we are importing is, in fact, a class ...
Read now
Unlock full access