- 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;
//...
}
推薦閱讀
- C++面向對象程序設計(第三版)
- The Supervised Learning Workshop
- Objective-C應用開發全程實錄
- 數據庫原理及應用(Access版)第3版
- CentOS 7 Linux Server Cookbook(Second Edition)
- PHP+MySQL網站開發技術項目式教程(第2版)
- 深入淺出DPDK
- Building a Recommendation Engine with Scala
- Learning Apache Kafka(Second Edition)
- C程序設計案例教程
- Oracle JDeveloper 11gR2 Cookbook
- 微信小程序開發與實戰(微課版)
- Learning PHP 7
- Android Development Tools for Eclipse
- Vue.js光速入門及企業項目開發實戰