Introduction
In this blog we are going discuss about angular2 architecture. Here we will discuss in brief about the building blocks that comes under Angular2.
Getting Started
In my previous article that listed in the below list, we have discussed about Angular2, the goal of Angular2 and how Angular2 is difference from AngularJS.
Angular2 architecture consists of 8 building blocks, the name of the building block is listed below.
- Modules
A module is nothing but blocks of code that is created for special proposes. The module exports the value of something from the code such as a .Net class. A module exports values, functions, and classes that other module uses it.
- Components
A component is nothing but like controller, it is a class with templated. It comes between view and model which knows itself how to render view and configure dependency injection to display logical data.
- Templates
The view of the component is defined through templates. Templates are basically the HTML we use to show on our page, it describes how the component is rendered on the page.
- Metadata
Metadata tells Angular how a class should be processed on the screen. It is a way of processing the class. Component tells Angular that the custom component (component is nothing but class) that you have built is a component. The decorator is used to attach component with Typescript.
- Data binding
Data binding is measure building blocks of any application or framework architecture, Angular2 support Data Binding. Data binding is used to display component property in view. You can say Data binding is the synchronization of data between the model and view components.
- Directives
Directive helps us to add behavior to the DOM elements. The directive is a class which contains metadata which will be attached to the class by the @Directive decorator. Template changes the DOM according to Directive while rendering.
- Services
Services are JavaScript functions that are responsible for doing a specific task only. Angular services are injected using Dependency Injection mechanism and include the value, function or feature which is required by the application. There nothing much about service in Angular and there is no ServiceBase class, but still services can be treated as fundamental to Angular application.
- Dependency Injection
Dependency Injection is a design pattern that passes an object as dependencies in different components across the application. It creates a new instance of class along with its required dependencies. The Dependency Injection is stimulated into the framework and can be used everywhere.
Summary
Hope you have got little ideas about basic building blocks of Angular2 architecture. Please give like or comment if this article helps you.
Thanks