
committed by
Matias Niemelä

parent
dd2a650c34
commit
2379ad1a4b
@ -1,11 +1,10 @@
|
||||
// #docregion
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HEROES } from './mock-heroes';
|
||||
import { HEROES } from './mock-heroes';
|
||||
|
||||
@Injectable({
|
||||
// we declare that this service should be created
|
||||
// by the root application injector.
|
||||
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class HeroService {
|
||||
|
@ -1,12 +1,11 @@
|
||||
// #docregion
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HeroModule } from './hero.module';
|
||||
import { HEROES } from './mock-heroes';
|
||||
import { HEROES } from './mock-heroes';
|
||||
|
||||
@Injectable({
|
||||
// we declare that this service should be created
|
||||
// by any injector that includes HeroModule.
|
||||
|
||||
providedIn: HeroModule,
|
||||
})
|
||||
export class HeroService {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// #docplaster
|
||||
// #docregion, v1
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
// #enddocregion v1
|
||||
import { HeroService } from './hero.service';
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
// #docregion
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class Logger {
|
||||
logs: string[] = []; // capture logs for testing
|
||||
|
||||
|
@ -11,7 +11,9 @@ export class User {
|
||||
let alice = new User('Alice', true);
|
||||
let bob = new User('Bob', false);
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserService {
|
||||
user = bob; // initial user is Bob
|
||||
|
||||
|
Reference in New Issue
Block a user