Components in Angular2 - Part6

Published: 01 January 1970
on channel: Code With Rohini
49
5

To learn Angular2 from scratch and most useful for beginners Please see the link below:
   • What is AngularJS and What is Angular...  

To understand components in detail please see below link:
https://angular.io/api/core/Component

In this video tutorial, we will discuss - What is a component in Angular 2

In Part 1 of the Angular 2 tutorial, we discussed that everything in Angular 2 is a component i.e components are the basic building blocks of an Angular application.

What is a component in Angular 2
A component in Angular is a class with a template and a decorator. So in simple terms, a component in Angular is composed of these 3 things
1. Template - Defines the user interface. Contains the HTML, directives, and bindings.
2. Class - Contains the code required for template. Just like a class in any object-oriented programming language like C# or Java, a class in angular can contain methods and properties. Properties contain the data that we want to display in the view template and methods contain the logic for the view. We use TypeScript to create the class.
3. Decorator - We use the Component decorator provided by Angular to add metadata to the class. A class becomes an Angular component when it is decorated with the Component decorator.

please fill free to asking any queries so please comment if u have any question.


Watch video Components in Angular2 - Part6 online, duration hours minute second in high quality that is uploaded to the channel Code With Rohini 01 January 1970. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 49 times and liked it 5 visitors.