- 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;
//...
}
推薦閱讀
- 從零構(gòu)建知識圖譜:技術(shù)、方法與案例
- Visual C++串口通信開發(fā)入門與編程實踐
- 云計算通俗講義(第3版)
- 鋒利的SQL(第2版)
- Data Analysis with Stata
- 嚴密系統(tǒng)設(shè)計:方法、趨勢與挑戰(zhàn)
- Python完全自學教程
- Java:High-Performance Apps with Java 9
- C語言程序設(shè)計實驗指導 (第2版)
- C++編程兵書
- Clojure for Java Developers
- C++程序設(shè)計教程(第2版)
- Visual C++程序設(shè)計與項目實踐
- UI動效設(shè)計從入門到精通
- Puppet Cookbook(Third Edition)