官术网_书友最值得收藏!

Services

Services are user-defined classes used to solve problems. Angular recommends only having template-specific codes in components. A component's responsibility is to enrich the UI/UX in the Angular application and delegate business logic to services. Components are consumers of services:

Application-specific or business logic such as persisting application data, logging errors, and file storage should be delegated to services, and components should consume the respective services to deal with the appropriate business or application-specific logic:

For example, we can have a service called BookService that deals with inserting new books, editing or deleting existing books, and fetching a list of all the books available.

We will see more about services in Chapter 11, Implementing Angular Pipes.

主站蜘蛛池模板: 马山县| 灵武市| 葵青区| 石台县| 河曲县| 洪泽县| 石嘴山市| 库车县| 香格里拉县| 巧家县| 鲁山县| 台北县| 墨玉县| 长顺县| 保定市| 孝义市| 元朗区| 绥德县| 永修县| 双桥区| 蓬莱市| 延边| 洪泽县| 吉安市| 阜宁县| 天津市| 屏东市| 古浪县| 泊头市| 六安市| 平南县| 苍山县| 华安县| 胶州市| 西昌市| 拜城县| 武邑县| 沛县| 北流市| 灵山县| 镇康县|