Angular component的职责
Angular Component的職責(zé):
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唯一的職責(zé)就是提供user experience,除此別無(wú)其他。一個(gè)Component應(yīng)當(dāng)包含properties和方法,用于數(shù)據(jù)綁定,以及作為視圖(通過(guò)模板渲染而成)和應(yīng)用邏輯之間溝通的渠道。
Angular Service
通過(guò)@Injectable()這個(gè)裝飾器將一個(gè)class定義成Angular服務(wù)。
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.
總結(jié)
以上是生活随笔為你收集整理的Angular component的职责的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 联想摩托罗拉 ThinkPhone 手机
- 下一篇: 摩托罗拉 razr 40 Ultra 手