@ -1,7 +1,6 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { HeroesComponent } from './heroes/heroes.component';
|
||||
import { HeroDetailComponent } from './hero-detail/hero-detail.component';
|
||||
@ -19,13 +18,9 @@ import { MessagesComponent } from './messages/messages.component';
|
||||
FormsModule
|
||||
],
|
||||
// #docregion providers
|
||||
// #docregion providers-heroservice
|
||||
providers: [
|
||||
// #enddocregion providers-heroservice
|
||||
// no need to place any providers due to the `providedIn` flag...
|
||||
// #docregion providers-heroservice
|
||||
],
|
||||
// #enddocregion providers-heroservice
|
||||
// #enddocregion providers
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
|
@ -8,7 +8,9 @@ import { Hero } from './hero';
|
||||
import { HEROES } from './mock-heroes';
|
||||
|
||||
// #docregion new
|
||||
@Injectable({providedIn: 'root'})
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class HeroService {
|
||||
|
||||
constructor() { }
|
||||
|
@ -14,7 +14,9 @@ import { HEROES } from './mock-heroes';
|
||||
import { MessageService } from './message.service';
|
||||
// #enddocregion import-message-service
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class HeroService {
|
||||
|
||||
// #docregion ctor
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MessageService {
|
||||
messages: string[] = [];
|
||||
|
||||
|
Reference in New Issue
Block a user