Angular 2 Tutorial (2016) - Dependency Injection (2/2)

preview_player
Показать описание

Angular 2 Tutorial on Dependency Injection. This video hows how to use Dependency Injection in Angular 2.

Get into developing Angular 2 applications instantly! Please share, like and comment if you like the video!

This course will teach you all the fundamentals of the current Angular 2 Beta and will prepare you to write actual Angular 2 web applications.

We will cover Directives, Components, Template Syntax, Two-Way-Data Binding, Services, HTTP (GET and POST) and much more!

Have fun and please leave a like or comment if you like (or dislike) this video or this series!
Рекомендации по теме
Комментарии
Автор

Thanks again for the series. Saw it all in one day :) Looking forward for more. Keep up the good work.

Автор

Thank you very much for these 2 videos!! You helped me out with DI a lot! Please continue doing what you're doing on YouTube :)

MaxBudnyk
Автор

Best possible explanation of DI and Service Injection into components !!!
Thanks.

PublicUser
Автор

Man, you're a great tutor. Keep it simple in that way, it's really useful and you should take into your consideration to make much more web development tutorials!

KarlMaged
Автор

hey man thanks for the series, is very helpful, just so you now people from Romania, Europe are watching this videos.I'm looking forward for. the next videos ;)

CrisProducts
Автор

Great tutorial showcasing DI. I understand it now :)

chadbender
Автор

u got another subscriber with these two videos. short and succinct, very well explained. great work.

tajnijjar
Автор

very nice editing in all the vidoes + you simplify things very good! thnak you for this and more!!

stavalfi
Автор

Thank you! Very good video series! This really cleared up a huge problem I have been struggling with. On how to get the same instance of a service! :) Now if you could make a video on Rxjs, specificly on how to repeat an http request with time intervals, you would have solved nearly all my problems :D Thanks again :)

TonyKrger
Автор

Thanks for this video. Super easy to understand how the DI works on Angular. BTW whats the editor you use to code?

madura
Автор

Some serious Dr Suess skills
"Another source of course"

NatHollings
Автор

Great Thanks! Please which it the code editor you use?

FotisKaralis
Автор

Great series! Can you make a video of an angular app that retrieves data from a database (MongoDB or also another)?

lucacortese
Автор

Also, is there any plans of tutorial on immutability (immutable.js) in new angular, because I don't really got idea, I used to write some clojurescript with immutability and atoms, and don't really get the idea of how to use it in typescript..

KyrychenkoAnton
Автор

Hi, could you explain the function @Inject()? I dont understand its purpose

wwmnyqy
Автор

Hi Max,
Again, many thanks for the videos. Ang2 resources are hard to find, and a lot of what is out there does not address questions I'm looking to answer. So many thanks for the well done tutorials.
I have a quick question I'm trying to confirm. Why did you register your provider [DataService] in boot.ts rather than in AppComponent? As I worked through the official dev guide tutorials, it seemed that they discouraged

"...
We do have to configure the injector by registering the providers that create the services our application requires. We'll explain what providers are later in this chapter. Before we do, let's see an example of provider registration during bootstrapping:

bootstrap(AppComponent,
[HeroService]); // DISCOURAGED (but works)
..."

So, my real two questions are:
1. Does registering DataService in AppComponent (your top level component) result in new instances in Components 1 & 2 and therefore not share the "miklshakes"?
2. If so, is registering in boot.ts the only way to guarentee a single instance of DataService?

Thanks for your time, and please know I'm in no way criticizing your tutorial, I am just trying to understand why you made that particular choice and if you had the problem I suspect. Cheers,
-Mike

michaelbates
Автор

OM... Angular 2 syntax is so stupid and old school.... 1. import service. 2. declare service in providers. 3. assigned service to private variable, 4. call service method from such a waste of time and unnecessary complexity.

Ember is a much better framework... To inject a service:
let myService = Ember.inject.service( "<service name>");
myService.callMethod();

Done.

LizardanNet