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.