October 2017
Intermediate to advanced
280 pages
6h 50m
English
Angular took this approach by introducing new building blocks called components. Components extend the directive concept we described in the previous section and provide a broader functionality. Here is the definition of a basic Hello world component:
@Component({
selector: 'hello-world',
template: '<h1>Hello, {{target}}!</h1>'
})
class HelloWorld {
target: string;
constructor() {
this.target = 'world';
}
}
We can use it by inserting the following markup in our view:
<hello-world></hello-world>
We will take a look at the preceding syntax in more detail later in this book. ...
Read now
Unlock full access