The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Provide and Share Values with Angular 2 Dependency Injection

Provide and Share Values with Angular 2 Dependency Injection

1:50
TypeScript is used heavily as we build up our application, but TypeScript isn’t required. If you want to Inject a Service without using TypeScript, you’ll need to understand the `@Inject` decorator. The `@Inject` decorator also allows you to provide any value or object that you need to share throughout your application without having to create a service.
Watch this lesson now
Avatar
egghead.io

TypeScript is used heavily as we build up our application, but TypeScript isn’t required. If you want to Inject a Service without using TypeScript, you’ll need to understand the @Inject decorator.

Avatar
Owen

Just a heads up, pretty sure this one should be after the next lesson! ;-)

Avatar
Ramses

Hi, is it ok that I had to use:
import {Inject} from 'angular2/di';
instead of (as was told on the video):
import {Inject} from 'angular2/angular2';

Avatar
Zach

Do you use the colemak keyboard? I noticed you typed "arst" with is the colemak equivalent of asdf.

Avatar
John

Yup, sure do. Nice eye :) I guess it would be pretty hard to roll arst on qwerty.

In reply to Zach
Avatar
danielpoulson

I noticed that you used the public key word, in the Angular docs they use the private. What is the difference between these? I.e Does private refer to the class only and if so does public refer to the application?

Avatar
Jesse

The link to the code on github is wrong, its to a different course. For this lesson no link appears, but then when I went to lesson one it has a link to the wrong course. After browsing through John Linquist on Github I found the correct one. Please update, and place the link on each lesson page. thanks

In reply to egghead.io
Avatar
Terry

Which dependency injection is the preferred way: @Inject or loading the class in the app.components?

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?