Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Mistake on bad-alternative example #3086

Closed
prpcastilho opened this issue Jan 10, 2017 · 3 comments · Fixed by #3091
Closed

Mistake on bad-alternative example #3086

prpcastilho opened this issue Jan 10, 2017 · 3 comments · Fixed by #3091

Comments

@prpcastilho
Copy link

On https://angular.io/docs/ts/latest/guide/hierarchical-dependency-injection.html, the example of a bad-alternative has an error with the declarations and bootstrap.
I think it is changed.
I know it's a bad alternative and should not be used, but I still think it should be correct.

// Don't do this!
@NgModule({
imports: [
BrowserModule,
FormsModule
],
providers: [ HeroesService, RestoreService ],
declarations: [ HeroesListComponent ],
bootstrap: [
HeroesListComponent,
HeroCardComponent,
HeroEditorComponent
]

})

@wardbell
Copy link
Contributor

I don't think you'll convince us but, as your suggestion is about Angular, not the Angular docs, you must post it as an issue on the angular website.

@prpcastilho
Copy link
Author

I probably explained myself poorly. I didn't make any suggestion about Angular, but rather I pointed an error existing on Angular docs https://angular.io/docs/ts/latest/guide/hierarchical-dependency-injection.html.
The code above (on my first comment) is not what i suggested to do, but is the error which exists on that page.

The correct solution is:
// Don't do this!
@NgModule({
imports: [
BrowserModule,
FormsModule
],
providers: [ HeroesService, RestoreService ],
declarations: [
HeroesListComponent,
HeroCardComponent,
HeroEditorComponent
],
bootstrap:
[ HeroesListComponent ]
}
)

As you write on the live example mention on that page.
Because we only may bootstrap one component, not three components like you have on that example.
I hope I have made me understand better now.

@wardbell wardbell reopened this Jan 11, 2017
@wardbell
Copy link
Contributor

wardbell commented Jan 11, 2017

OH MY! You are absolutely right. Thanks for catching that. Fixing. See PR #3091
I ended up removing the example which wasn't particularly helpful anyway.

wardbell added a commit to IdeaBlade/angular.io that referenced this issue Jan 12, 2017
…ther tweaks

closes angular#3086
sample reworked to conform to our sample style, to make more sense, and cover the examples discussed
copy edits to bring closer to Google docs standards.
wardbell added a commit to IdeaBlade/angular.io that referenced this issue Jan 12, 2017
…ther tweaks

closes angular#3086
sample reworked to conform to our sample style, to make more sense, and cover the examples discussed
copy edits to bring closer to Google docs standards.
wardbell added a commit that referenced this issue Jan 13, 2017
)

* closes #3086
* samples reworked to conform to our sample style, make more sense, and cover the points in prose.
* copy edits to bring closer to Google docs standards.
abdel-ships-it pushed a commit to abdel-ships-it/angular.io that referenced this issue Feb 11, 2017
…ore (angular#3091)

* closes angular#3086
* samples reworked to conform to our sample style, make more sense, and cover the points in prose.
* copy edits to bring closer to Google docs standards.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants