October 2017
Intermediate to advanced
280 pages
6h 50m
English
Let's suppose we're building a component called fancy-button. This component will use the standard HTML button element and add some extra behavior to it. Here is the definition of the fancy-button component:
@Component({
selector: 'fancy-button',
template: '<button>Click me</button>'
})
class FancyButton { ... }
Inside of the @Component decorator, we set the inline template of the component together with its selector. Now, we can use the component with the following markup:
<fancy-button></fancy-button>
On the screen, we will see a standard HTML button that has a label with the Click me content. This is not a very flexible way to define reusable UI components. Most likely, the users of the fancy button ...
Read now
Unlock full access