single-spa-angular
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -22,2 +22,3 @@ "use strict"; | ||
ApplicationRef: null, | ||
NgZone: null, | ||
domElementGetter: null // only optional if you provide a domElementGetter as a custom prop | ||
@@ -59,2 +60,17 @@ | ||
return Promise.resolve().then(function () { | ||
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier. | ||
opts.zoneIdentifier = "single-spa-angular:".concat(props.name || props.appName); | ||
if (opts.NgZone) { | ||
// This is a hack, since NgZone doesn't allow you to configure the property that identifies your zone. | ||
// See https://github.com/PlaceMe-SAS/single-spa-angular-cli/issues/33, | ||
// https://github.com/CanopyTax/single-spa-angular/issues/47, | ||
// https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L144, | ||
// and https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L257 | ||
opts.NgZone.isInAngularZone = function () { | ||
// @ts-ignore | ||
return window.Zone.current.get(opts.zoneIdentifier) === true; | ||
}; | ||
} | ||
opts.routingEventListener = function (evt) { | ||
@@ -92,2 +108,6 @@ /* When popstate and hashchange events occur, single-spa delays them in order to | ||
return opts.angularPlatform.bootstrapModule(opts.mainModule).then(function (module) { | ||
if (opts.NgZone) { | ||
module.injector.get(opts.NgZone)._inner._properties[opts.zoneIdentifier] = true; | ||
} | ||
opts.bootstrappedModule = module; | ||
@@ -94,0 +114,0 @@ |
{ | ||
"name": "single-spa-angular", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Helpers for building single-spa applications which use Angular 2", | ||
@@ -5,0 +5,0 @@ "main": "lib/single-spa-angular.js", |
@@ -9,2 +9,3 @@ const defaultOpts = { | ||
ApplicationRef: null, | ||
NgZone: null, | ||
domElementGetter: null, // only optional if you provide a domElementGetter as a custom prop | ||
@@ -48,2 +49,17 @@ }; | ||
return Promise.resolve().then(() => { | ||
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier. | ||
opts.zoneIdentifier = `single-spa-angular:${props.name || props.appName}`; | ||
if (opts.NgZone) { | ||
// This is a hack, since NgZone doesn't allow you to configure the property that identifies your zone. | ||
// See https://github.com/PlaceMe-SAS/single-spa-angular-cli/issues/33, | ||
// https://github.com/CanopyTax/single-spa-angular/issues/47, | ||
// https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L144, | ||
// and https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L257 | ||
opts.NgZone.isInAngularZone = function() { | ||
// @ts-ignore | ||
return window.Zone.current.get(opts.zoneIdentifier) === true; | ||
} | ||
} | ||
opts.routingEventListener = function(evt) { | ||
@@ -86,2 +102,5 @@ /* When popstate and hashchange events occur, single-spa delays them in order to | ||
.then(module => { | ||
if (opts.NgZone) { | ||
module.injector.get(opts.NgZone)._inner._properties[opts.zoneIdentifier] = true; | ||
} | ||
opts.bootstrappedModule = module; | ||
@@ -88,0 +107,0 @@ if (opts.ApplicationRef) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37041
245