Skip to content

Conversation

@gkalpak
Copy link
Member

@gkalpak gkalpak commented Jun 1, 2022

Previously, UpgradeModule#bootstrap(), while being a replacement for and accepting the same arguments as angular.bootstrap(), did not return the same value as angular.bootstrap() (i.e. the AngularJS injector in most cases). This made it less straight forward to migrate some usecases that relied on the return value of .bootstrap(). The work-around was to access the injector via UpgradeModule#$injector (after the app had been bootstrapped with UpgradeModule#bootstrap()).

This commit addresses this by ensuring UpgradeModule#bootstrap() returns the same value as angular.bootstrap(), making it easier to replace the latter with the former.

Fixes #46211.

@gkalpak gkalpak added type: bug/fix area: upgrade Issues related to AngularJS → Angular upgrade APIs target: minor This PR is targeted for the next minor release labels Jun 1, 2022
@ngbot ngbot bot modified the milestone: Backlog Jun 1, 2022
@gkalpak gkalpak changed the title fix(upgrade): more closely align UpgradeModule#bootstrap() with angular.bootstrap() feat(upgrade): more closely align UpgradeModule#bootstrap() with angular.bootstrap() Jun 1, 2022
@gkalpak gkalpak force-pushed the fix-upgrade-bootstrap branch from 9d850dd to 22085c3 Compare June 1, 2022 20:09
@mary-poppins
Copy link

@gkalpak gkalpak force-pushed the fix-upgrade-bootstrap branch from 22085c3 to c16a2d6 Compare June 2, 2022 10:44
gkalpak added 2 commits June 2, 2022 13:45
Add some tests for the `UpgradeModule` class and its members.
…ngular.bootstrap()`

Previously, [UpgradeModule#bootstrap()][1], while being a replacement
for and accepting the same arguments as [angular.bootstrap()][2], did
not return the same value as `angular.bootstrap()` (i.e. the AngularJS
injector in most cases). This made it less straight forward to migrate
some usecases that relied on the return value of `.bootstrap()`. The
work-around was to access the injector via [UpgradeModule#$injector][3]
(after the app had been bootstrapped with `UpgradeModule#bootstrap()`).

This commit addresses this by ensuring `UpgradeModule#bootstrap()`
returns the same value as `angular.bootstrap()`, making it easier to
replace the latter with the former.

[1]: https://angular.io/api/upgrade/static/UpgradeModule#bootstrap
[2]: https://docs.angularjs.org/api/ng/function/angular.bootstrap
[3]: https://angular.io/api/upgrade/static/UpgradeModule#%24injector

Fixes angular#46211
@mary-poppins
Copy link

@gkalpak gkalpak marked this pull request as ready for review June 2, 2022 11:05
@gkalpak gkalpak added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 2, 2022
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

Reviewed-for: public-api

Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

reviewed-for: fw-upgrade, public-api

@gkalpak gkalpak 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 labels Jun 3, 2022
@alxhub
Copy link
Member

alxhub commented Jun 3, 2022

This PR was merged into the repository by commit e9cb045.

@alxhub alxhub closed this in 4e5e312 Jun 3, 2022
alxhub pushed a commit that referenced this pull request Jun 3, 2022
…ngular.bootstrap()` (#46214)

Previously, [UpgradeModule#bootstrap()][1], while being a replacement
for and accepting the same arguments as [angular.bootstrap()][2], did
not return the same value as `angular.bootstrap()` (i.e. the AngularJS
injector in most cases). This made it less straight forward to migrate
some usecases that relied on the return value of `.bootstrap()`. The
work-around was to access the injector via [UpgradeModule#$injector][3]
(after the app had been bootstrapped with `UpgradeModule#bootstrap()`).

This commit addresses this by ensuring `UpgradeModule#bootstrap()`
returns the same value as `angular.bootstrap()`, making it easier to
replace the latter with the former.

[1]: https://angular.io/api/upgrade/static/UpgradeModule#bootstrap
[2]: https://docs.angularjs.org/api/ng/function/angular.bootstrap
[3]: https://angular.io/api/upgrade/static/UpgradeModule#%24injector

Fixes #46211

PR Close #46214
@gkalpak gkalpak deleted the fix-upgrade-bootstrap branch June 6, 2022 18:51
@angular-automatic-lock-bot
Copy link

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 Jul 7, 2022
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 area: upgrade Issues related to AngularJS → Angular upgrade APIs target: minor This PR is targeted for the next minor release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'$locationShim': Not a valid '@angular/upgrade' application.

5 participants