Skip to content

feat(bootstrap): add platform and app initializers#5355

Closed
vsavkin wants to merge 1 commit into
angular:masterfrom
vsavkin:platform_initializers
Closed

feat(bootstrap): add platform and app initializers#5355
vsavkin wants to merge 1 commit into
angular:masterfrom
vsavkin:platform_initializers

Conversation

@vsavkin
Copy link
Copy Markdown
Contributor

@vsavkin vsavkin commented Nov 18, 2015

Often some init logic needs to run when a platform or an application is boostrapped.
For example, boostraping a platform requires initializing the dom adapter.
Now, it can be done as follows:

new Provider(PLATFORM_INITIALIZER, {useValue: initDomAdapter, multi: true}),

All platform initializers will be run after the platform injector has been created.

Similarly, all application initializers will be run after the app injector has been
created.

@vsavkin vsavkin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed cla: yes labels Nov 18, 2015
@vsavkin vsavkin added this to the beta-00 milestone Nov 18, 2015
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why clone?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because we are removing items from the collection while iterating over it. This never worked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lol

On Wed, Nov 18, 2015 at 8:35 AM Victor Savkin notifications@github.com
wrote:

In modules/angular2/src/core/application_ref.ts
#5355 (comment):

@@ -439,7 +465,7 @@ export class ApplicationRef_ extends ApplicationRef {

dispose(): void {
// TODO(alxhub): Dispose of the NgZone.

  • this._rootComponents.forEach((ref) => ref.dispose());
  • ListWrapper.clone(this._rootComponents).forEach((ref) => ref.dispose());

Because we are removing items from the collection while iterating over it.
This never worked.


Reply to this email directly or view it on GitHub
https://github.com/angular/angular/pull/5355/files#r45223098.

@IgorMinar
Copy link
Copy Markdown
Contributor

overall this looks good to me. please answer the questions above and merge.

@IgorMinar
Copy link
Copy Markdown
Contributor

and get CI to pass

@IgorMinar IgorMinar added pr_state: LGTM action: merge The PR is ready for merge by the caretaker labels Nov 18, 2015
@IgorMinar IgorMinar assigned vsavkin and unassigned IgorMinar Nov 18, 2015
@IgorMinar IgorMinar added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Nov 18, 2015
@vsavkin vsavkin force-pushed the platform_initializers branch from c047443 to acfd8bb Compare November 18, 2015 16:48
Often some init logic needs to run when a platform or an application is boostrapped.
For example, boostraping a platform requires initializing the dom adapter.
Now, it can be done as follows:

new Provider(PLATFORM_INITIALIZER, {useValue: initDomAdapter, multi: true}),

All platform initializers will be run after the platform injector has been created.

Similarly, all application initializers will be run after the app injector has been
created.
@vsavkin vsavkin force-pushed the platform_initializers branch from acfd8bb to ed1cbb7 Compare November 18, 2015 17:18
@vsavkin vsavkin added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Nov 18, 2015
@mary-poppins
Copy link
Copy Markdown

Merging PR #5355 on behalf of @alxhub to branch presubmit-alxhub-pr-5355.

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants