Angular component的职责
Angular Component的職責:
Ideally, a component’s job is to enable the user experience and nothing more. A component should present properties and methods for data binding, in order to mediate between the view (rendered by the template) and the application logic (which often includes some notion of a model).
理想情況下,Angular Component唯一的職責就是提供user experience,除此別無其他。一個Component應當包含properties和方法,用于數據綁定,以及作為視圖(通過模板渲染而成)和應用邏輯之間溝通的渠道。
Angular Service
通過@Injectable()這個裝飾器將一個class定義成Angular服務。
To define a class as a service in Angular, use the @Injectable() decorator to provide the metadata that allows Angular to inject it into a component as a dependency.
總結
以上是生活随笔為你收集整理的Angular component的职责的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 联想摩托罗拉 ThinkPhone 手机
- 下一篇: 摩托罗拉 razr 40 Ultra 手