- Essential Angular
- Victor Savkin Jeff Cross
- 137字
- 2021-07-02 22:56:28
Components and Directives
To build an Angular application you define a set of components, for every UI element, screen, and route. An application will always have root components (usually just one) that contain all other components. To make things simpler, in this book let's assume the application has a single root component, and thus our Angular application will have a component tree, that may look like this:

AppCmp is the root component. The FiltersCmp component has the speaker input and the filter button. TalksCmp is the list you see at the bottom. And TalkCmp is an item in that list. To understand what constitutes a component in Angular, let's look closer at TalkCmp:
@Component({
selector: 'talk-cmp',
template: `
{{talk.title}} {{talk.speaker}}
{{talk.rating | formatRating }}
<watch-button [talk]="talk"></watch-button>
<rate-button [talk]="talk"></rate-button>
`
})
class TalkCmp {
@Input() talk: Talk;
@Output() rate: EventEmitter;
//...
}
推薦閱讀
- 程序員修煉之道:程序設(shè)計入門30講
- TypeScript Blueprints
- Python for Secret Agents:Volume II
- 摩登創(chuàng)客:與智能手機(jī)和平板電腦共舞
- Spring技術(shù)內(nèi)幕:深入解析Spring架構(gòu)與設(shè)計
- Visual C
- MATLAB定量決策五大類問題
- Python編程從0到1(視頻教學(xué)版)
- INSTANT Adobe Edge Inspect Starter
- Kotlin Programming By Example
- Java Web應(yīng)用開發(fā)給力起飛
- Flink技術(shù)內(nèi)幕:架構(gòu)設(shè)計與實(shí)現(xiàn)原理
- R語言實(shí)戰(zhàn)(第2版)
- JavaScript語法簡明手冊
- 你好!Python