There is now a new, recommended, way to register a provider, directly inside the @Injectable() decorator, using the new providedIn attribute. @Injectable({ providedIn: 'root' }) export class UserService { } When you use 'root', your injectable will b…
In this lesson, we’re going to take a look at how add a class to the providers property of a component creates an actual providers. We’ll learn what a provider specifically does and how we can provide different dependencies with the same token. impor…
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. import {Component, View, Inject} from "angular2/angul…
When creating a service, need to inject the sercive into the bootstrap(): import {bootstrap, Component, View} from "angular2/angular2"; import {TodoInput} from "./todoInput"; import {TodoService} from "./todoService"; @Compon…