By AmarSivas | | Updated : 2018-05-27 | Viewed : 899 times
Please find the below given diagram for different type of code blocks/clases and how they are interacted each other.
First we will discuss about the ngmodule. The main theme of making application as modules is maintenance and reusability.
When we want to organize a complex application, we should make application as number of modules. So we can easily maintain application. Ngmodule will be used for maintenance and reusability. We can combine all similar functional code blocks such as services, components as one module. So entire code maintenance will be easy and we can reuse the different modules. Each module will be represented as unique module for specific purpose
A template contains html and binding markup. Before rendering the html elements, Angular will create or modify the html elements by using the binding markup. Binding markup will be used by the angular to know the way of rendering. The markup or binding markup will be provided by the directives.
Directive is class, will be used by angular to render the template into the DOM. Directive contains the logic, which will be used to render the template. While before rendering the template as html into DOM, angular will render the html as per directive’s instruction.
Service classes will send/fetch data to/from the server/back end. The fetched data will be used by component to display as view. Simply we can say services are responsible for specific functionality. Some of the services classes are reusable. Actually service classes will injected by Injectors as decencies into components. Service classes contains the metadata, which is useful for injecting the service into the components.