Angular 2 Components

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

Angular 2 Tutorial playlist

Angular 2 Text articles and slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

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

In Part 1 of 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.

// Component decorator is provided by the Angular core library, so we
// have to import it before using it. The import keyword is similar to
// using keyword in C#. Any exported member can be imported using import
// keyowrd.

// The class is decorated with Component decorator which adds metadata
// to the class. We use the @ symbol to apply a decorator to the class
// Applying a decorator on a class is similar to applying an attribute
// to a class in C# or other programming languages. Component is just
// one of the deveral built-in decorators provided by angular. We will
// discuss the other decorators provided by angular in upcoming videos
@Component({
// component has several properties. Here we are using just 2. For
// the full list of properties refer to the following URL
// To use this component on any HTML page we specify the selector
// This selector becomes the directive [my-app] on the HTML page
// At run time, the directive [my-app] is replaced by the template
// HTML specified below
selector: 'my-app',
// The template contains the HTML to render. Notice in the HTML
// we have a data-binding expression specified by double curly
// braces. We have a defualt value "Angular" assigned to "name"
// property in the AppComponent class. This will be used at runtime
// inplace of the data-binding expression
template: `[h1]Hello {{name}}[/h1]`,
})
// export keyword allows this class to be exported, so other components
// in the application can import and use it if required
export class AppComponent {
// name is a property and the data type is string and
// has a default value "angular"
name: string = 'Angular';
}

[my-app]Loading AppComponent content here ...[/my-app]

Рекомендации по теме
Комментарии
Автор

The man on the rescue again. thank you sir for starting the series!

subhajitsarkar
Автор

Even Angular Team Can't Explain In This 'Creamy' Way ! Awesome !

niluniverse
Автор

Believe me sir you are awesome. I follow many tutorial of Angular 2 but non of work to me. Finally i am Happy with your tutorials. you save my life and jobs :) Thanks again

harisahmed
Автор

I have learn angular 1.5 from this tutorial now angular 2. thanks for save my life and jobs.

debendrananda
Автор

Man this was so smooth. I am Java Springboot Backend Developer learning Angular for Full Stack requirement and guess what?? Venkat Sir has just made these concepts so clear that even .net with Angular is making sense to me. Tbh the Best explanation over Component so far in Youtube. Respect 🙏

akhiljaiswal
Автор

After your video tutorials we don't need to watch much from other tutorials. So comprehensive

rajeshlohana
Автор

very descriptive and explained in a beautiful way, any non technical person would also understand, keep uploading more videos Sir, You are a saviour for people like me who have no interest in technology, but would love to code, if i am provided with such amazing training, Thanks again for making these videos free . :)

jade
Автор

u are like god to me a strategy, what a lecture....please upload remaining videos

vamshidharreddy
Автор

i've been folowing for more than 5 years, ur the best teacher i've ever seen

amineayoubiIT
Автор

your teachings are extraordinary. Many thanks kudvenkat.

williamsbotchway
Автор

kudvenkat sir is the best tutor I have ever witnessed.

parvezmulla
Автор

Your explanation is really great sir, thanks a lot...

ThumbIKR
Автор

Venkat you are really awesome....Keep going it is really helpful to us.

pawanwankhade
Автор

Very helpful. I really appreciate you !!

prashantbiradar
Автор

very very good !!! you are awesome man!
Thanks I Love u :)

emkexlw
Автор

Very nice explanation to start Angular 2. Really great work.

krrr
Автор

Your explanation is very clear and nice. Please make complete Angular 2 tutorial. Thank you.

sandeepgouru
Автор

Thanks a lot sir...Waiting for the next :)

Sriram_Chhotaray
Автор

Hi sir, ur videos are awessome add next videos on angular 2 ASAP. bcoz I have started angular 2 learning by watching ur videos only....

tukarammundkar
Автор

Very good videos on Angular. Please post the remaining part also

vinod