-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Angular Design Patterns and Best Practices
By :

Services in Angular are TypeScript classes that aim to implement business logic for our interfaces. Business logic in a frontend project can seem like a controversial issue because ideally, all logic and processing should take place on the backend, which is correct.
Here we are using business rules; these rules are generic behaviors that do not depend on a visual component and can be reused in other components.
Examples of frontend business rules could be as follows:
We are going to put this concept into practice, and in our gym diary application, we are going to create the first service. In the command line we will use the Angular CLI:
ng generate service diary/services/ExerciseSets
Unlike the component, we can see that the element created by the Angular CLI is composed only of a TypeScript...