Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: change examples within services to be tree-shakeable #23070

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions aio/content/examples/toh-pt4/src/app/app.module.ts
Expand Up @@ -5,8 +5,6 @@ import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { HeroesComponent } from './heroes/heroes.component';
import { HeroDetailComponent } from './hero-detail/hero-detail.component';
import { HeroService } from './hero.service';
import { MessageService } from './message.service';
import { MessagesComponent } from './messages/messages.component';

@NgModule({
Expand All @@ -23,9 +21,8 @@ import { MessagesComponent } from './messages/messages.component';
// #docregion providers
// #docregion providers-heroservice
providers: [
HeroService,
// #enddocregion providers-heroservice
MessageService
// no need to place any providers due to the `providedIn` flag...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jenniferfell this will likely require a change in the text referring to this region.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The surrounding text is changed in PR #22934

// #docregion providers-heroservice
],
// #enddocregion providers-heroservice
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt4/src/app/hero.service.1.ts
Expand Up @@ -8,7 +8,7 @@ import { Hero } from './hero';
import { HEROES } from './mock-heroes';

// #docregion new
@Injectable()
@Injectable({providedIn: 'root'})
export class HeroService {

constructor() { }
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt4/src/app/hero.service.ts
Expand Up @@ -14,7 +14,7 @@ import { HEROES } from './mock-heroes';
import { MessageService } from './message.service';
// #enddocregion import-message-service

@Injectable()
@Injectable({ providedIn: 'root' })
export class HeroService {

// #docregion ctor
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt4/src/app/message.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';

@Injectable()
@Injectable({ providedIn: 'root' })
export class MessageService {
messages: string[] = [];

Expand Down
3 changes: 0 additions & 3 deletions aio/content/examples/toh-pt5/src/app/app.module.ts
Expand Up @@ -7,8 +7,6 @@ import { AppComponent } from './app.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { HeroDetailComponent } from './hero-detail/hero-detail.component';
import { HeroesComponent } from './heroes/heroes.component';
import { HeroService } from './hero.service';
import { MessageService } from './message.service';
import { MessagesComponent } from './messages/messages.component';

// #docregion routing-module
Expand All @@ -30,7 +28,6 @@ import { AppRoutingModule } from './app-routing.module';
MessagesComponent
],
// #enddocregion dashboard
providers: [ HeroService, MessageService ],
bootstrap: [ AppComponent ]
// #docregion routing-module
})
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt5/src/app/hero.service.ts
Expand Up @@ -6,7 +6,7 @@ import { Hero } from './hero';
import { HEROES } from './mock-heroes';
import { MessageService } from './message.service';

@Injectable()
@Injectable({ providedIn: 'root' })
export class HeroService {

constructor(private messageService: MessageService) { }
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt5/src/app/message.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';

@Injectable()
@Injectable({ providedIn: 'root' })
export class MessageService {
messages: string[] = [];

Expand Down
3 changes: 0 additions & 3 deletions aio/content/examples/toh-pt6/src/app/app.module.ts
Expand Up @@ -19,8 +19,6 @@ import { HeroesComponent } from './heroes/heroes.component';
// #enddocregion v1
import { HeroSearchComponent } from './hero-search/hero-search.component';
// #docregion v1
import { HeroService } from './hero.service';
import { MessageService } from './message.service';
import { MessagesComponent } from './messages/messages.component';

@NgModule({
Expand Down Expand Up @@ -49,7 +47,6 @@ import { MessagesComponent } from './messages/messages.component';
HeroSearchComponent
// #docregion v1
],
providers: [ HeroService, MessageService ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt6/src/app/hero.service.ts
Expand Up @@ -19,7 +19,7 @@ const httpOptions = {
};
// #enddocregion http-options

@Injectable()
@Injectable({ providedIn: 'root' })
export class HeroService {

// #docregion heroesUrl
Expand Down
2 changes: 1 addition & 1 deletion aio/content/examples/toh-pt6/src/app/message.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';

@Injectable()
@Injectable({ providedIn: 'root' })
export class MessageService {
messages: string[] = [];

Expand Down