From e59eb37d7d6f057f1cbb91b8b891ee7d1b86bfa2 Mon Sep 17 00:00:00 2001 From: Bert Verhelst Date: Mon, 25 Sep 2017 17:28:43 +0200 Subject: [PATCH] docs(upgrade): Add missing providers for downgrading a service --- .../app/ajs-to-a-providers/hero-detail.component.ts | 1 + aio/content/guide/upgrade.md | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/aio/content/examples/upgrade-module/src/app/ajs-to-a-providers/hero-detail.component.ts b/aio/content/examples/upgrade-module/src/app/ajs-to-a-providers/hero-detail.component.ts index b02f85b99a5cf0..6612a2d90aa37c 100644 --- a/aio/content/examples/upgrade-module/src/app/ajs-to-a-providers/hero-detail.component.ts +++ b/aio/content/examples/upgrade-module/src/app/ajs-to-a-providers/hero-detail.component.ts @@ -5,6 +5,7 @@ import { Hero } from '../hero'; @Component({ selector: 'hero-detail', + providers: [HeroesService], template: `

{{hero.id}}: {{hero.name}}

` diff --git a/aio/content/guide/upgrade.md b/aio/content/guide/upgrade.md index 433e1f13b4d69a..33bb9cbee265cf 100644 --- a/aio/content/guide/upgrade.md +++ b/aio/content/guide/upgrade.md @@ -778,13 +778,22 @@ delete them once the upgrade is over. It's also recommended to export the `heroesServiceFactory` function so that Ahead-of-Time compilation can pick it up. +
+ +Note that the 'heroes' string inside the factory refers to the AngularJS `HeroesService`. +It is common in AngularJS apps to chose a service name for the token (e.g. heroes) +and append the Service suffix to create the class name (e.g. heroesService) + +
+ -You can then inject it in Angular using it's class as a type annotation: +You can then inject it in Angular by adding the service to the component providers +and using it's class as a type annotation in the component constructor: