angular-cn/goldens/public-api
George Kalpakas b4b21bdff4 fix(upgrade): fix HMR for hybrid applications (#40045)
Previously, trying to apply a change via Hot Module Replacement (HMR) in
a hybrid app would result in an error. This was caused by not having the
AngularJS app destroyed and thus trying to bootstrap an AngularJS app on
the same element twice.

This commit fixes HMR for hybrid apps by ensuring the AngularJS app is
destroyed when the Angular `PlatformRef` is [destroyed][1] in the
[`module.hot.dispose()` callback][2].

NOTE:
For "ngUpgradeLite" apps (i.e. those using `downgradeModule()`), HMR
will only work if the downgraded module has been bootstrapped and there
is at least one Angular component present on the page. The is due to a
combination of two facts:
- The logic for setting up the listener that destroys the AngularJS app
  depends on the downgraded module's `NgModuleRef`, which is only
  available after the module has been bootstrapped.
- The [HMR dispose logic][3] depends on having an Angular element
  (identified by the auto-geenrated `ng-version` attribute) present in
  the DOM in order to retrieve the Angular `PlatformRef`.

[1]:
https://github.com/angular/angular-cli/blob/205ea2b638f154291993bfd9e065cd66ff20503/packages/angular_devkit/build_angular/src/webpack/plugins/hmr/hmr-accept.ts#L75
[2]:
205ea2b638/packages/angular_devkit/build_angular/src/webpack/plugins/hmr/hmr-accept.ts (L31)
[3]:
205ea2b638/packages/angular_devkit/build_angular/src/webpack/plugins/hmr/hmr-accept.ts (L116)

Fixes #39935

PR Close #40045
2020-12-10 13:40:53 -08:00
..
animations ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
common refactor(http): inline HttpObserve (#18417) 2020-12-01 12:13:04 -08:00
compiler-cli refactor(compiler-cli): split out template diagnostics package (#38576) 2020-09-03 14:02:31 -07:00
core fix(core): Allow passing AbstractType to the inject function (#37958) 2020-11-24 10:42:21 -08:00
elements feat(compiler-cli): add support for TypeScript 4.0 (#38076) 2020-08-24 13:06:59 -07:00
forms docs(forms): Deprecate legacy options for FormBuilder.group (#39769) 2020-11-25 14:28:11 -08:00
localize ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
platform-browser ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
platform-browser-dynamic ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
platform-server fix(platform-server): Resolve absolute URL from baseUrl (#39334) 2020-10-21 09:41:58 -07:00
platform-webworker ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
platform-webworker-dynamic ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
router feat(router): add `relativeTo` as an input to `routerLink` (#39720) 2020-12-10 11:21:00 -08:00
service-worker feat(service-worker): add the option to prefer network for navigation requests (#38565) 2020-09-22 09:29:20 -07:00
upgrade fix(upgrade): fix HMR for hybrid applications (#40045) 2020-12-10 13:40:53 -08:00
manage.js ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00