Тёмный

Angular 2 Components 

kudvenkat
Подписаться 829 тыс.
Просмотров 372 тыс.
50% 1

Text version of the video
csharp-video-tutorials.blogspo...
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 RU-vid channel. Hope you can help.
/ @aarvikitchen5572
Slides
csharp-video-tutorials.blogspo...
Angular 2 Tutorial playlist
• Angular 2 tutorial for...
Angular 2 Text articles and slides
csharp-video-tutorials.blogspo...
All Dot Net and SQL Server Tutorials in English
ru-vid.com...
All Dot Net and SQL Server Tutorials in Arabic
/ kudvenkatarabic
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 Example : In Part 2 of this video series we have downloaded quick start files from the Angular Website. One of the files in these quick start files, is the app.component.ts file. You can find this file in the "app" folder. This file contain a component. The name of the component is AppComponent. The AppComponent is the root component of the application. I have commented the code in the following example and it should be self-explanatory. If it's not, please watch the video by clicking here.
// 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.
import { Component } from '@angular/core';
// 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
// angular.io/docs/ts/latest/api...
// 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';
}
Notice in the index.html page, we have used the AppComponent using the directive [my-app]. At runtime [my-app] directive is replaced with the HTML we specified using the selector property in the component decorator.
[my-app]Loading AppComponent content here ...[/my-app]
When we build the project in Visual Studio TypeScript is compiled to JavaScript which the browser understands and renders. Our TypeScript code for this component is present in app.component.ts file. Notice a corresponding app.component.js is file is generated on build.

Наука

Опубликовано:

 

29 май 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 99   
@niluniverse
@niluniverse 7 лет назад
Even Angular Team Can't Explain In This 'Creamy' Way ! Awesome !
@helloworld8201
@helloworld8201 7 лет назад
101% true .
@NooOnee1111
@NooOnee1111 6 лет назад
I agreed, i love his way of teaching.
@hamidnawaz9678
@hamidnawaz9678 6 лет назад
'Creamy' way best for venkat
@harisahmed4874
@harisahmed4874 7 лет назад
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
@niluniverse
@niluniverse 7 лет назад
Haris Ahmed that's true
@amineayoubiIT
@amineayoubiIT 4 года назад
i've been folowing for more than 5 years , ur the best teacher i've ever seen
@Csharp-video-tutorialsBlogspot
@Csharp-video-tutorialsBlogspot 4 года назад
Hello Ayoubi - Thank you for being our valued subscriber and really glad you are finding our courses useful. All the best.
@subhajitsarkar2643
@subhajitsarkar2643 7 лет назад
The man on the rescue again. thank you sir for starting the series!
@akhiljaiswal9468
@akhiljaiswal9468 2 года назад
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 RU-vid. Respect 🙏
@debendrananda382
@debendrananda382 6 лет назад
I have learn angular 1.5 from this tutorial now angular 2. thanks for save my life and jobs.
@vamshidharreddy3851
@vamshidharreddy3851 7 лет назад
u are like god to me sir.....excellent....what a strategy ,what a lecture....please upload remaining videos waiting......
@rajeshlohana100
@rajeshlohana100 6 лет назад
After your video tutorials we don't need to watch much from other tutorials. So comprehensive
@williamsbotchway2471
@williamsbotchway2471 7 лет назад
your teachings are extraordinary. Many thanks kudvenkat.
@jade7945
@jade7945 6 лет назад
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 . :)
@parvezmulla3324
@parvezmulla3324 5 лет назад
kudvenkat sir is the best tutor I have ever witnessed.
@ThumbIKR
@ThumbIKR 6 лет назад
Your explanation is really great sir, thanks a lot...
@samart7756
@samart7756 6 лет назад
Anna you rock !! Meru life saver unda
@pawanwankhade17
@pawanwankhade17 7 лет назад
Venkat you are really awesome....Keep going it is really helpful to us.
@prashantbiradar7896
@prashantbiradar7896 6 лет назад
Very helpful. I really appreciate you !!
@Sakeer89
@Sakeer89 6 лет назад
No words to explain, you are awesome
@krrr25
@krrr25 7 лет назад
Very nice explanation to start Angular 2. Really great work.
@user-em3ke8xl8w
@user-em3ke8xl8w 7 лет назад
very very good !!! you are awesome man! Thanks I Love u :)
@namahshrestha3226
@namahshrestha3226 6 лет назад
Omg..wow..you're just awsome
@sandeepgouru2286
@sandeepgouru2286 7 лет назад
Your explanation is very clear and nice. Please make complete Angular 2 tutorial. Thank you.
@MrDpk27
@MrDpk27 6 лет назад
sir you are the best tutor !!!
@Sriram_Chhotaray
@Sriram_Chhotaray 7 лет назад
Thanks a lot sir...Waiting for the next :)
@tukarammundkar9238
@tukarammundkar9238 7 лет назад
Hi sir, ur videos are awessome ...........plese add next videos on angular 2 ASAP. bcoz I have started angular 2 learning by watching ur videos only....
@vinod8923
@vinod8923 7 лет назад
Very good videos on Angular. Please post the remaining part also
@hemantkonade7797
@hemantkonade7797 7 лет назад
please upload videos for crud operations in angular 2 with web api
@Scenary2
@Scenary2 5 лет назад
great work.nice explanation sir.
@matheshwaran602
@matheshwaran602 7 лет назад
wonderful explanation .
@sasoft8116
@sasoft8116 6 лет назад
good work kudvenkat , can plz record video on publish angular component to npm
@RachitJain4U
@RachitJain4U 5 лет назад
Awesome :) Thanks :)
@upendram2453
@upendram2453 7 лет назад
wonderful explanation
@Rhyckthegreat
@Rhyckthegreat 7 лет назад
Is it possible to using the angular CLI within angular and visual studio project?
@daviddonadze221
@daviddonadze221 7 лет назад
thank u so much
@StudyWithGiri
@StudyWithGiri 7 лет назад
Really sir you are awesome
@kattakapilkumar
@kattakapilkumar 5 лет назад
Very Helpful for beginners.
@RameshMavuluri
@RameshMavuluri 6 лет назад
It comes under Metadata. I got it. Thanks.
@mohamedsameel
@mohamedsameel 7 лет назад
Hello Sir, It can be silly for you but doubt for me, first question is does each component file can have only one class? how the component.template get name value from AppComponent class? It doens't seem any connection between component and class. if there multiple class with same name atrib in the same file how can we relate name attrib from one class only?
@arttasticreelalert1806
@arttasticreelalert1806 4 года назад
Hello sir, i have learned Asp.net entity framework, bootstrap,sql server, mvc, .net basic,oops, and interview questions also also from you videos and this is really great experience for me. now i am watching angular 2 for getting idea and to start angular8 , but here i am not getting intelligence in visual studio in components file other than that everything is fine can you please help me out in that. Thanks in advance
@icasemobileservicecenter3293
@icasemobileservicecenter3293 5 лет назад
why u not use visual studio code ?
@hamzehhanandeh3647
@hamzehhanandeh3647 7 лет назад
good video, thank you
@Sam-de2ht
@Sam-de2ht 5 лет назад
thank you very much,
@chetanpl
@chetanpl 7 лет назад
one more thing you have downloaded the SRC folder and other folders. do we have create all these stuffed myself.
@sanjeevgaur1973
@sanjeevgaur1973 6 лет назад
in later video you have shown property as get() and set(value:string), here just declaring variables in class will become a property?
@chetanpl
@chetanpl 7 лет назад
hi sir I appreciate you . you are doing a wonderful job for us .. thank you again but I have a question for HTML template you were uses index.html. now if I want to use other template rather than index.html. can I use it?
@reddy-mu6of
@reddy-mu6of 5 лет назад
Nice explanation sir
@RameshMavuluri
@RameshMavuluri 6 лет назад
With Template Class Decorator, The component has the selector as well right.
@NourLababidi
@NourLababidi 6 лет назад
When do you name a class "nameComponent" vs "nameController"? thank you for great videos!
@chicku975
@chicku975 6 лет назад
Very Nice tutorial
@Varunkumarmca
@Varunkumarmca 6 лет назад
u r awesome
@raqibul1000
@raqibul1000 7 лет назад
Thanks
@chebilhamed629
@chebilhamed629 7 лет назад
Sir, how to unit test methods bound to events in angular 2 ?
@MithunKumar-nu5jd
@MithunKumar-nu5jd 7 лет назад
Hi Sir, when I am trying to install SpaTemplates I am facing this error. can you help me with this? how to resolve Unable to resolve 'Microsoft.NETCore.App (>= 1.0.4)' for '.NETCoreApp,Version=v1.0'. Unable to resolve 'Microsoft.AspNetCore.SpaTemplates' for '.NETCoreApp,Version=v1.0'.
@dipenjitdas5324
@dipenjitdas5324 6 лет назад
great.
@Brand73
@Brand73 7 лет назад
besides showing syntax, please include demonstrations of how to build a real life app. thanks
@sagargenre
@sagargenre 9 дней назад
best than paid courses
@chaitanyashejwal5358
@chaitanyashejwal5358 5 лет назад
Error! Please Help. I have written all the lines that you wrote, followed each and every step but I am still getting these errors. Severity Code Description Project File Line Suppression State Error Build:Property 'lift' in type 'Subject' is not assignable to the same property in base type 'Observable'. Angular2Demo A:\Angular 2\Angular2Demo\Angular2Demo ode_modules xjs\Subject.d.ts 24 Severity Code Description Project File Line Suppression State Error TS2416 Property 'lift' in type 'Subject' is not assignable to the same property in base type 'Observable'. Type '(operator: Operator) => Observable' is not assignable to type '(operator: Operator) => Observable'. Type 'Observable' is not assignable to type 'Observable'. Type 'T' is not assignable to type 'R'. TypeScript Virtual Projects A:\Angular 2\Angular2Demo\Angular2Demo ode_modules xjs\Subject.d.ts 24 Active Severity Code Description Project File Line Suppression State Error Build:Property 'lift' in type 'Subject' is not assignable to the same property in base type 'Observable'. Angular2Demo A:\Angular 2\Angular2Demo\Angular2Demo ode_modules xjs\Subject.d.ts 24
@vipinbutola7085
@vipinbutola7085 7 лет назад
please sir add more vedios on angular js 2😊
@lanka9471
@lanka9471 6 лет назад
Sir, Please can you tell me the difference between component and a directive? Asked in interview!
@vikrant.mishra
@vikrant.mishra 6 лет назад
Your videos are seriously awesome but I want to know one thing that How compiler come to know that the startup file is index.html. Where can we set it to different html file.
@debendrananda382
@debendrananda382 6 лет назад
waiting.... for Angular 4
@saihussain5261
@saihussain5261 6 лет назад
what is the use of component compare by controller rather than reuseability
@vinothrajendran858
@vinothrajendran858 5 лет назад
I am using vs2019. i have started the tutorial today. Compile on save is not working for me. I have done all things as said in this video. Any help?
@rahulpathak7552
@rahulpathak7552 6 лет назад
Thanks for so clear and concise description , when i am building the application getting two error but while running it running.Severity Code Error Build:Class 'Subject' incorrectly extends base class 'Observable'. Angular2Test
@ayanchakraborty7842
@ayanchakraborty7842 6 лет назад
I am having the same issue .Seems like in Subject.d.ts file is having the issue..if you get it solved please post it ..
@arpitjain9932
@arpitjain9932 6 лет назад
You can check this link in order to resolve this error: stackoverflow.com/questions/44810195/how-do-i-get-around-this-subject-incorrectly-extends-observable-error-in-types
@sowminidanam
@sowminidanam 6 лет назад
got strucked here ERROR in ./src/app/employee/employee.component.ts Module not found: Error: Can't resolve './app/employee/employee.component.html' in 'E:\Empl\my-app\src\app\employee' resolve './app/employee/employee.component.html' in 'E:\Empl\my-app\src\app\empl oyee' using description file: E:\Empl\my-app\package.json (relative path: ./src/app/ employee) Field 'browser' doesn't contain a valid alias configuration after using description file: E:\Empl\my-app\package.json (relative path: ./sr c/app/employee) using description file: E:\Empl\my-app\package.json (relative path: ./src/ap p/employee/app/employee/employee.component.html) no extension Field 'browser' doesn't contain a valid alias configuration E:\Empl\my-app\src\app\employee\app\employee\employee.component.html doe sn't exist .ts Field 'browser' doesn't contain a valid alias configuration E:\Empl\my-app\src\app\employee\app\employee\employee.component.html.ts doesn't exist .js Field 'browser' doesn't contain a valid alias configuration E:\Empl\my-app\src\app\employee\app\employee\employee.component.html.js doesn't exist as directory E:\Empl\my-app\src\app\employee\app\employee\employee.component.html doe sn't exist [E:\Empl\my-app\src\app\employee\app\employee\employee.component.html] [E:\Empl\my-app\src\app\employee\app\employee\employee.component.html.ts] [E:\Empl\my-app\src\app\employee\app\employee\employee.component.html.js] [E:\Empl\my-app\src\app\employee\app\employee\employee.component.html] @ ./src/app/employee/employee.component.ts 18:22-71 @ ./src/app/app.module.ts @ ./src/main.ts @ multi webpack-dev-server/client?0.0.0.0:0 ./src/main.ts webpack: Failed to compile.
@sathyanarayanan1428
@sathyanarayanan1428 6 лет назад
please provide link for source code for this entire tutorial, so that it woud be helpful for us to practice
@priyaahir2949
@priyaahir2949 4 года назад
Please make videos on Angular 8.
@MK-qv4lu
@MK-qv4lu 6 лет назад
sir can i learn it through vs code
@haw143
@haw143 4 года назад
"Severity Code Description Project File Line Suppression State Error Build:Property 'lift' in type 'Subject' is not assignable to the same property in base type 'Observable'. AngularDemoApp G:\Angular\Project\AngularDemoApp\AngularDemoApp ode_modules xjs\Subject.d.ts 24 " getting this error in VS 2017
@kelechiigbe9369
@kelechiigbe9369 7 лет назад
Thanksssssssssssssssss
@tryb4uquit
@tryb4uquit 7 лет назад
KudVenkat ..Thank you
@krishponugumati6710
@krishponugumati6710 5 лет назад
Hello sir.... great explination , but u have done this in visual studio.... can i get angular 2 videos using angular/cli it will be more helpful... i think if we use angular/cli it will be more easy. We can just use commands to creat everything.
@Csharp-video-tutorialsBlogspot
Hello Venkata Krishna - I agree with you. Here is the Angular CLI course. ru-vid.com/group/PL6n9fhu94yhWUcq5Pc16uf8YKXoZ87Vh_ Angular CRUD course is created using Angular CLI. Hope this helps. ru-vid.com/group/PL6n9fhu94yhXwcl3a6rIfAI7QmGYIkfK5
@muhamedshafeeq568
@muhamedshafeeq568 7 лет назад
Single Quote will work for single line .
@ayanchakraborty7842
@ayanchakraborty7842 6 лет назад
##Need Help## Error Build:Class 'Subject' incorrectly extends base class 'Observable'. File:Subject.d.ts line: 16 D:\Projects\Angular2Demo\Angular2Demo ode_modules xjs\Subject.d.ts I am facing this problem and the build is not succeeded.
@arpitjain9932
@arpitjain9932 6 лет назад
You can check this link in order to resolve this error: stackoverflow.com/questions/44810195/how-do-i-get-around-this-subject-incorrectly-extends-observable-error-in-types
@sandeepkumarbrungi7574
@sandeepkumarbrungi7574 4 года назад
selector name is not getting changed in index.html?
@haw143
@haw143 4 года назад
yes can you help me plz
@gamezblock7717
@gamezblock7717 7 лет назад
sir,i have problem in how to connect angular 2 with SQL server database how we use in real time project
@danythegrappler
@danythegrappler 7 лет назад
Kshitiz Bhargav you can use http services to access sql server objects. in short angular2 is a client end framework and you can use http to request resources from server
@danythegrappler
@danythegrappler 7 лет назад
Kshitiz Bhargav use asp net Web Api or wcf services to expose your database objects to your angular2 client
@city8742
@city8742 5 лет назад
intellisense doesn't working for em
@param8378
@param8378 6 лет назад
how to use parent html and css because parent component in third party library while overriding parent component????????? any genius persons answer me???????
@shareefmohammed6574
@shareefmohammed6574 6 лет назад
Please upload videos of angular2 tutorial in visual studio code.
@Csharp-video-tutorialsBlogspot
Visual Studio Code is used with the course at the following link. Hope this helps. ru-vid.com/group/PL6n9fhu94yhXwcl3a6rIfAI7QmGYIkfK5
@shareefmohammed6574
@shareefmohammed6574 6 лет назад
Thank u bro. i learned Dot net now angular from u. very helpful
@ceruttigino
@ceruttigino 7 лет назад
Sir, this backtick thing seems unnecessary to me, It works just the same with quotes...
@Csharp-video-tutorialsBlogspot
Good spot. Please check the next videos in this series, and you will understand when to use backticks over single or double quotes, Hope this helps.
@ceruttigino
@ceruttigino 7 лет назад
AHAHAHA MULTILINE!!!!! ;)
@ayanchakraborty7842
@ayanchakraborty7842 6 лет назад
Subject.d.ts file is throwing error sir..please help. Error Build:Class 'Subject' incorrectly extends base class 'Observable'. File:Subject.d.ts line: 16
@saisrikar7987
@saisrikar7987 5 лет назад
Sexy Explanation..Kudos!!
@alexweeda2826
@alexweeda2826 4 года назад
no caption
@Csharp-video-tutorialsBlogspot
@Csharp-video-tutorialsBlogspot 4 года назад
Hello Alex - You can turn the captions ON, using the Settings button that is present on the lower bottom right hand corner of the RU-vid player. Hope this helps.
Далее
Angular template vs templateurl
6:34
Просмотров 244 тыс.
Angular 2 nested components
13:00
Просмотров 292 тыс.
O-Zone - Numa Numa yei на русском!🤓
00:56
Просмотров 177 тыс.
Angular 2 http service tutorial
22:15
Просмотров 211 тыс.
Angular modules and controllers
11:47
Просмотров 1 млн
Angular component output properties
16:56
Просмотров 153 тыс.
Angular 2 routing tutorial
17:38
Просмотров 129 тыс.
Property binding in Angular 2
10:36
Просмотров 203 тыс.
Собери ПК и Получи 10,000₽
1:00
Просмотров 2,7 млн
😮Новый ДИРЕКТОР Apple🍏
0:29
Просмотров 39 тыс.