What is component in angular.

In this article we will discuss about the component that we are using angular2 application .

A angular component mainly consist of three things.
1. Class
2. Template
3. Metadata.

We will discuss it one by one .
Lets first add a component through Visual studio code.


Basically the component is created with .ts extensions and we keep the name as filename.component.ts .
Now we will discuss it one by one.

1. Class :
Like other object oriented programming language we declare the class . class is declared with a name and having some property , method and constructor as well.

2. Template :
 Template is nothing but an view part of the application . What ever we want to render in the screen that should be mentioned in the template section . Basically the template section contains the HTML content.

3. Metaddata :

 Its a extra data used to decorate the angular class for behaving the class properly.
Angular2 uses several entries for metadata like annotations, design : paramtypes , popMetadata and parameters etc.



Please do not forget to comment and like this article.

Comments

Popular posts from this blog

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

The transaction is aborted or Failure while attempting to promote transaction.

Unable to load one or more breakpoints in Visual studio.