- 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;
//...
}
推薦閱讀
- 程序員面試筆試寶典(第3版)
- .NET之美:.NET關鍵技術深入解析
- Progressive Web Apps with React
- 軟件項目管理(第2版)
- Python入門很簡單
- Android 7編程入門經(jīng)典:使用Android Studio 2(第4版)
- Python高級編程
- 人臉識別原理及算法:動態(tài)人臉識別系統(tǒng)研究
- Python高級機器學習
- Cassandra Data Modeling and Analysis
- 零基礎入門學習Python
- Mastering Apache Maven 3
- C語言程序設計教程
- C語言程序設計上機指導與習題解答(第2版)
- Arduino可穿戴設備開發(fā)