@angular/router 3.4.6 → 3.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/router-testing.umd.js +1 -1
- package/bundles/router-upgrade.umd.js +11 -22
- package/bundles/router-upgrade.umd.min.js +2 -2
- package/bundles/router.umd.js +155 -25
- package/bundles/router.umd.min.js +4 -4
- package/package.json +4 -4
- package/src/interfaces.d.ts +10 -10
- package/src/interfaces.js.map +1 -1
- package/src/router.d.ts +1 -1
- package/src/router.js +36 -4
- package/src/router.js.map +1 -1
- package/src/router_config_loader.js +9 -3
- package/src/router_config_loader.js.map +1 -1
- package/src/router_module.d.ts +57 -6
- package/src/router_module.js +135 -18
- package/src/router_module.js.map +1 -1
- package/src/router_module.metadata.json +1 -1
- package/src/router_preloader.js +1 -1
- package/src/router_preloader.js.map +1 -1
- package/src/version.js +1 -1
- package/src/version.js.map +1 -1
- package/src/version.metadata.json +1 -1
- package/upgrade.d.ts +4 -4
- package/upgrade.js +11 -22
- package/upgrade.js.map +1 -1
- package/upgrade.metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v3.4.
|
|
2
|
+
* @license Angular v3.4.10
|
|
3
3
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/(function (global, factory) {
|
|
@@ -32,30 +32,16 @@
|
|
|
32
32
|
* @experimental
|
|
33
33
|
*/
|
|
34
34
|
var RouterUpgradeInitializer = {
|
|
35
|
-
provide:
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
provide: _angular_core.APP_BOOTSTRAP_LISTENER,
|
|
36
|
+
multi: true,
|
|
37
|
+
useFactory: locationSyncBootstrapListener,
|
|
38
|
+
deps: [_angular_upgrade_static.UpgradeModule]
|
|
38
39
|
};
|
|
39
40
|
/**
|
|
40
41
|
* @internal
|
|
41
42
|
*/
|
|
42
|
-
function
|
|
43
|
-
return function () {
|
|
44
|
-
if (!ngUpgrade.$injector) {
|
|
45
|
-
throw new Error("\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n ");
|
|
46
|
-
}
|
|
47
|
-
var router = ngUpgrade.injector.get(_angular_router.Router);
|
|
48
|
-
var ref = ngUpgrade.injector.get(_angular_core.ApplicationRef);
|
|
49
|
-
router.resetRootComponentType(ref.componentTypes[0]);
|
|
50
|
-
preloader.setUpPreloading();
|
|
51
|
-
if (opts.initialNavigation === false) {
|
|
52
|
-
router.setUpLocationChangeListener();
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
router.initialNavigation();
|
|
56
|
-
}
|
|
57
|
-
setUpLocationSync(ngUpgrade);
|
|
58
|
-
};
|
|
43
|
+
function locationSyncBootstrapListener(ngUpgrade) {
|
|
44
|
+
return function () { setUpLocationSync(ngUpgrade); };
|
|
59
45
|
}
|
|
60
46
|
/**
|
|
61
47
|
* @whatItDoes Sets up a location synchronization.
|
|
@@ -66,6 +52,9 @@
|
|
|
66
52
|
* @experimental
|
|
67
53
|
*/
|
|
68
54
|
function setUpLocationSync(ngUpgrade) {
|
|
55
|
+
if (!ngUpgrade.$injector) {
|
|
56
|
+
throw new Error("\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n ");
|
|
57
|
+
}
|
|
69
58
|
var router = ngUpgrade.injector.get(_angular_router.Router);
|
|
70
59
|
var url = document.createElement('a');
|
|
71
60
|
ngUpgrade.$injector.get('$rootScope')
|
|
@@ -76,7 +65,7 @@
|
|
|
76
65
|
}
|
|
77
66
|
|
|
78
67
|
exports.RouterUpgradeInitializer = RouterUpgradeInitializer;
|
|
79
|
-
exports.
|
|
68
|
+
exports.locationSyncBootstrapListener = locationSyncBootstrapListener;
|
|
80
69
|
exports.setUpLocationSync = setUpLocationSync;
|
|
81
70
|
|
|
82
71
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v3.4.
|
|
2
|
+
* @license Angular v3.4.10
|
|
3
3
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
|
-
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@angular/router"),require("@angular/upgrade/static")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/router","@angular/upgrade/static"],factory):factory((global.ng=global.ng||{},global.ng.router=global.ng.router||{},global.ng.router.upgrade=global.ng.router.upgrade||{}),global.ng.core,global.ng.router,global.ng.upgrade.static)}(this,function(exports,_angular_core,_angular_router,_angular_upgrade_static){"use strict";function
|
|
6
|
+
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@angular/router"),require("@angular/upgrade/static")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/router","@angular/upgrade/static"],factory):factory((global.ng=global.ng||{},global.ng.router=global.ng.router||{},global.ng.router.upgrade=global.ng.router.upgrade||{}),global.ng.core,global.ng.router,global.ng.upgrade.static)}(this,function(exports,_angular_core,_angular_router,_angular_upgrade_static){"use strict";function locationSyncBootstrapListener(ngUpgrade){return function(){setUpLocationSync(ngUpgrade)}}function setUpLocationSync(ngUpgrade){if(!ngUpgrade.$injector)throw new Error("\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n ");var router=ngUpgrade.injector.get(_angular_router.Router),url=document.createElement("a");ngUpgrade.$injector.get("$rootScope").$on("$locationChangeStart",function(_,next,__){url.href=next,router.navigateByUrl(url.pathname)})}var RouterUpgradeInitializer={provide:_angular_core.APP_BOOTSTRAP_LISTENER,multi:!0,useFactory:locationSyncBootstrapListener,deps:[_angular_upgrade_static.UpgradeModule]};exports.RouterUpgradeInitializer=RouterUpgradeInitializer,exports.locationSyncBootstrapListener=locationSyncBootstrapListener,exports.setUpLocationSync=setUpLocationSync});
|
package/bundles/router.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v3.4.
|
|
2
|
+
* @license Angular v3.4.10
|
|
3
3
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/(function (global, factory) {
|
|
@@ -268,8 +268,14 @@
|
|
|
268
268
|
return rxjs_observable_fromPromise.fromPromise(this.loader.load(loadChildren));
|
|
269
269
|
}
|
|
270
270
|
else {
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
return rxjs_operator_mergeMap.mergeMap.call(wrapIntoObservable(loadChildren()), function (t) {
|
|
272
|
+
if (t instanceof _angular_core.NgModuleFactory) {
|
|
273
|
+
return rxjs_observable_of.of(t);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
return rxjs_observable_fromPromise.fromPromise(_this.compiler.compileModuleAsync(t));
|
|
277
|
+
}
|
|
278
|
+
});
|
|
273
279
|
}
|
|
274
280
|
};
|
|
275
281
|
return RouterConfigLoader;
|
|
@@ -3299,6 +3305,14 @@
|
|
|
3299
3305
|
function defaultErrorHandler(error) {
|
|
3300
3306
|
throw error;
|
|
3301
3307
|
}
|
|
3308
|
+
/**
|
|
3309
|
+
* \@internal
|
|
3310
|
+
* @param {?} snapshot
|
|
3311
|
+
* @return {?}
|
|
3312
|
+
*/
|
|
3313
|
+
function defaultRouterHook(snapshot) {
|
|
3314
|
+
return rxjs_observable_of.of(null);
|
|
3315
|
+
}
|
|
3302
3316
|
/**
|
|
3303
3317
|
* Does not detach any subtrees. Reuses routes as long as their route config is the same.
|
|
3304
3318
|
*/
|
|
@@ -3378,6 +3392,16 @@
|
|
|
3378
3392
|
this.navigated = false;
|
|
3379
3393
|
/**
|
|
3380
3394
|
* Extracts and merges URLs. Used for Angular 1 to Angular 2 migrations.
|
|
3395
|
+
* Used by RouterModule. This allows us to
|
|
3396
|
+
* pause the navigation either before preactivation or after it.
|
|
3397
|
+
* @internal
|
|
3398
|
+
*/
|
|
3399
|
+
this.hooks = {
|
|
3400
|
+
beforePreactivation: defaultRouterHook,
|
|
3401
|
+
afterPreactivation: defaultRouterHook
|
|
3402
|
+
};
|
|
3403
|
+
/**
|
|
3404
|
+
* Extracts and merges URLs. Used for AngularJS to Angular migrations.
|
|
3381
3405
|
*/
|
|
3382
3406
|
this.urlHandlingStrategy = new DefaultUrlHandlingStrategy();
|
|
3383
3407
|
this.routeReuseStrategy = new DefaultRouteReuseStrategy();
|
|
@@ -3754,16 +3778,19 @@
|
|
|
3754
3778
|
else {
|
|
3755
3779
|
urlAndSnapshot$ = rxjs_observable_of.of({ appliedUrl: url, snapshot: precreatedState });
|
|
3756
3780
|
}
|
|
3781
|
+
var /** @type {?} */ beforePreactivationDone$ = rxjs_operator_mergeMap.mergeMap.call(urlAndSnapshot$, function (p) {
|
|
3782
|
+
return rxjs_operator_map.map.call(_this.hooks.beforePreactivation(p.snapshot), function () { return p; });
|
|
3783
|
+
});
|
|
3757
3784
|
// run preactivation: guards and data resolvers
|
|
3758
3785
|
var /** @type {?} */ preActivation;
|
|
3759
|
-
var /** @type {?} */ preactivationTraverse$ = rxjs_operator_map.map.call(
|
|
3786
|
+
var /** @type {?} */ preactivationTraverse$ = rxjs_operator_map.map.call(beforePreactivationDone$, function (_a) {
|
|
3760
3787
|
var appliedUrl = _a.appliedUrl, snapshot = _a.snapshot;
|
|
3761
3788
|
preActivation =
|
|
3762
3789
|
new PreActivation(snapshot, _this.currentRouterState.snapshot, _this.injector);
|
|
3763
3790
|
preActivation.traverse(_this.outletMap);
|
|
3764
3791
|
return { appliedUrl: appliedUrl, snapshot: snapshot };
|
|
3765
3792
|
});
|
|
3766
|
-
var /** @type {?} */ preactivationCheckGuards = rxjs_operator_mergeMap.mergeMap.call(preactivationTraverse$, function (_a) {
|
|
3793
|
+
var /** @type {?} */ preactivationCheckGuards$ = rxjs_operator_mergeMap.mergeMap.call(preactivationTraverse$, function (_a) {
|
|
3767
3794
|
var appliedUrl = _a.appliedUrl, snapshot = _a.snapshot;
|
|
3768
3795
|
if (_this.navigationId !== id)
|
|
3769
3796
|
return rxjs_observable_of.of(false);
|
|
@@ -3771,7 +3798,7 @@
|
|
|
3771
3798
|
return { appliedUrl: appliedUrl, snapshot: snapshot, shouldActivate: shouldActivate };
|
|
3772
3799
|
});
|
|
3773
3800
|
});
|
|
3774
|
-
var /** @type {?} */ preactivationResolveData$ = rxjs_operator_mergeMap.mergeMap.call(preactivationCheckGuards
|
|
3801
|
+
var /** @type {?} */ preactivationResolveData$ = rxjs_operator_mergeMap.mergeMap.call(preactivationCheckGuards$, function (p) {
|
|
3775
3802
|
if (_this.navigationId !== id)
|
|
3776
3803
|
return rxjs_observable_of.of(false);
|
|
3777
3804
|
if (p.shouldActivate) {
|
|
@@ -3781,9 +3808,12 @@
|
|
|
3781
3808
|
return rxjs_observable_of.of(p);
|
|
3782
3809
|
}
|
|
3783
3810
|
});
|
|
3811
|
+
var /** @type {?} */ preactivationDone$ = rxjs_operator_mergeMap.mergeMap.call(preactivationResolveData$, function (p) {
|
|
3812
|
+
return rxjs_operator_map.map.call(_this.hooks.afterPreactivation(p.snapshot), function () { return p; });
|
|
3813
|
+
});
|
|
3784
3814
|
// create router state
|
|
3785
3815
|
// this operation has side effects => route state is being affected
|
|
3786
|
-
var /** @type {?} */ routerState$ = rxjs_operator_map.map.call(
|
|
3816
|
+
var /** @type {?} */ routerState$ = rxjs_operator_map.map.call(preactivationDone$, function (_a) {
|
|
3787
3817
|
var appliedUrl = _a.appliedUrl, snapshot = _a.snapshot, shouldActivate = _a.shouldActivate;
|
|
3788
3818
|
if (shouldActivate) {
|
|
3789
3819
|
var /** @type {?} */ state = createRouterState(_this.routeReuseStrategy, snapshot, _this.currentRouterState);
|
|
@@ -5217,7 +5247,7 @@
|
|
|
5217
5247
|
var /** @type {?} */ res = [];
|
|
5218
5248
|
for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
|
|
5219
5249
|
var c = routes_1[_i];
|
|
5220
|
-
// we already have the config loaded, just
|
|
5250
|
+
// we already have the config loaded, just recurse
|
|
5221
5251
|
if (c.loadChildren && !c.canLoad && ((c))._loadedConfig) {
|
|
5222
5252
|
var /** @type {?} */ childConfig = ((c))._loadedConfig;
|
|
5223
5253
|
res.push(this.processRoutes(childConfig.injector, childConfig.routes));
|
|
@@ -5507,26 +5537,123 @@
|
|
|
5507
5537
|
return router.routerState.root;
|
|
5508
5538
|
}
|
|
5509
5539
|
/**
|
|
5510
|
-
*
|
|
5511
|
-
*
|
|
5512
|
-
*
|
|
5513
|
-
*
|
|
5514
|
-
*
|
|
5540
|
+
* To initialize the router properly we need to do in two steps:
|
|
5541
|
+
*
|
|
5542
|
+
* We need to start the navigation in a APP_INITIALIZER to block the bootstrap if
|
|
5543
|
+
* a resolver or a guards executes asynchronously. Second, we need to actually run
|
|
5544
|
+
* activation in a BOOTSTRAP_LISTENER. We utilize the afterPreactivation
|
|
5545
|
+
* hook provided by the router to do that.
|
|
5546
|
+
*
|
|
5547
|
+
* The router navigation starts, reaches the point when preactivation is done, and then
|
|
5548
|
+
* pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
|
|
5515
5549
|
*/
|
|
5516
|
-
|
|
5517
|
-
|
|
5550
|
+
var RouterInitializer = (function () {
|
|
5551
|
+
/**
|
|
5552
|
+
* @param {?} injector
|
|
5553
|
+
*/
|
|
5554
|
+
function RouterInitializer(injector) {
|
|
5555
|
+
this.injector = injector;
|
|
5556
|
+
this.initNavigation = false;
|
|
5557
|
+
this.resultOfPreactivationDone = new rxjs_Subject.Subject();
|
|
5558
|
+
}
|
|
5559
|
+
/**
|
|
5560
|
+
* @return {?}
|
|
5561
|
+
*/
|
|
5562
|
+
RouterInitializer.prototype.appInitializer = function () {
|
|
5563
|
+
var _this = this;
|
|
5564
|
+
var /** @type {?} */ p = this.injector.get(_angular_common.LOCATION_INITIALIZED, Promise.resolve(null));
|
|
5565
|
+
return p.then(function () {
|
|
5566
|
+
var /** @type {?} */ resolve = null;
|
|
5567
|
+
var /** @type {?} */ res = new Promise(function (r) { return resolve = r; });
|
|
5568
|
+
var /** @type {?} */ router = _this.injector.get(Router);
|
|
5569
|
+
var /** @type {?} */ opts = _this.injector.get(ROUTER_CONFIGURATION);
|
|
5570
|
+
if (_this.isLegacyDisabled(opts) || _this.isLegacyEnabled(opts)) {
|
|
5571
|
+
resolve(true);
|
|
5572
|
+
}
|
|
5573
|
+
else if (opts.initialNavigation === 'disabled') {
|
|
5574
|
+
router.setUpLocationChangeListener();
|
|
5575
|
+
resolve(true);
|
|
5576
|
+
}
|
|
5577
|
+
else if (opts.initialNavigation === 'enabled') {
|
|
5578
|
+
router.hooks.afterPreactivation = function () {
|
|
5579
|
+
// only the initial navigation should be delayed
|
|
5580
|
+
if (!_this.initNavigation) {
|
|
5581
|
+
_this.initNavigation = true;
|
|
5582
|
+
resolve(true);
|
|
5583
|
+
return _this.resultOfPreactivationDone;
|
|
5584
|
+
}
|
|
5585
|
+
else {
|
|
5586
|
+
return rxjs_observable_of.of(null);
|
|
5587
|
+
}
|
|
5588
|
+
};
|
|
5589
|
+
router.initialNavigation();
|
|
5590
|
+
}
|
|
5591
|
+
else {
|
|
5592
|
+
throw new Error("Invalid initialNavigation options: '" + opts.initialNavigation + "'");
|
|
5593
|
+
}
|
|
5594
|
+
return res;
|
|
5595
|
+
});
|
|
5596
|
+
};
|
|
5597
|
+
/**
|
|
5598
|
+
* @param {?} bootstrappedComponentRef
|
|
5599
|
+
* @return {?}
|
|
5600
|
+
*/
|
|
5601
|
+
RouterInitializer.prototype.bootstrapListener = function (bootstrappedComponentRef) {
|
|
5602
|
+
var /** @type {?} */ opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
5603
|
+
var /** @type {?} */ preloader = this.injector.get(RouterPreloader);
|
|
5604
|
+
var /** @type {?} */ router = this.injector.get(Router);
|
|
5605
|
+
var /** @type {?} */ ref = this.injector.get(_angular_core.ApplicationRef);
|
|
5518
5606
|
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
5519
5607
|
return;
|
|
5520
5608
|
}
|
|
5521
|
-
|
|
5522
|
-
preloader.setUpPreloading();
|
|
5523
|
-
if (opts.initialNavigation === false) {
|
|
5524
|
-
router.setUpLocationChangeListener();
|
|
5525
|
-
}
|
|
5526
|
-
else {
|
|
5609
|
+
if (this.isLegacyEnabled(opts)) {
|
|
5527
5610
|
router.initialNavigation();
|
|
5528
5611
|
}
|
|
5612
|
+
else if (this.isLegacyDisabled(opts)) {
|
|
5613
|
+
router.setUpLocationChangeListener();
|
|
5614
|
+
}
|
|
5615
|
+
preloader.setUpPreloading();
|
|
5616
|
+
router.resetRootComponentType(ref.componentTypes[0]);
|
|
5617
|
+
this.resultOfPreactivationDone.next(null);
|
|
5618
|
+
this.resultOfPreactivationDone.complete();
|
|
5529
5619
|
};
|
|
5620
|
+
/**
|
|
5621
|
+
* @param {?} opts
|
|
5622
|
+
* @return {?}
|
|
5623
|
+
*/
|
|
5624
|
+
RouterInitializer.prototype.isLegacyEnabled = function (opts) {
|
|
5625
|
+
return opts.initialNavigation === 'legacy_enabled' || opts.initialNavigation === true ||
|
|
5626
|
+
opts.initialNavigation === undefined;
|
|
5627
|
+
};
|
|
5628
|
+
/**
|
|
5629
|
+
* @param {?} opts
|
|
5630
|
+
* @return {?}
|
|
5631
|
+
*/
|
|
5632
|
+
RouterInitializer.prototype.isLegacyDisabled = function (opts) {
|
|
5633
|
+
return opts.initialNavigation === 'legacy_disabled' || opts.initialNavigation === false;
|
|
5634
|
+
};
|
|
5635
|
+
RouterInitializer.decorators = [
|
|
5636
|
+
{ type: _angular_core.Injectable },
|
|
5637
|
+
];
|
|
5638
|
+
/** @nocollapse */
|
|
5639
|
+
RouterInitializer.ctorParameters = function () { return [
|
|
5640
|
+
{ type: _angular_core.Injector, },
|
|
5641
|
+
]; };
|
|
5642
|
+
return RouterInitializer;
|
|
5643
|
+
}());
|
|
5644
|
+
/**
|
|
5645
|
+
* @param {?} r
|
|
5646
|
+
* @return {?}
|
|
5647
|
+
*/
|
|
5648
|
+
function getAppInitializer(r) {
|
|
5649
|
+
return r.appInitializer.bind(r);
|
|
5650
|
+
}
|
|
5651
|
+
/**
|
|
5652
|
+
* @param {?} r
|
|
5653
|
+
* @return {?}
|
|
5654
|
+
*/
|
|
5655
|
+
function getBootstrapListener(r) {
|
|
5656
|
+
return r.bootstrapListener.bind(r);
|
|
5530
5657
|
}
|
|
5531
5658
|
/**
|
|
5532
5659
|
* A token for the router initializer that will be called after the app is bootstrapped.
|
|
@@ -5539,11 +5666,14 @@
|
|
|
5539
5666
|
*/
|
|
5540
5667
|
function provideRouterInitializer() {
|
|
5541
5668
|
return [
|
|
5669
|
+
RouterInitializer,
|
|
5542
5670
|
{
|
|
5543
|
-
provide:
|
|
5544
|
-
|
|
5545
|
-
|
|
5671
|
+
provide: _angular_core.APP_INITIALIZER,
|
|
5672
|
+
multi: true,
|
|
5673
|
+
useFactory: getAppInitializer,
|
|
5674
|
+
deps: [RouterInitializer]
|
|
5546
5675
|
},
|
|
5676
|
+
{ provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] },
|
|
5547
5677
|
{ provide: _angular_core.APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
5548
5678
|
];
|
|
5549
5679
|
}
|
|
@@ -5551,7 +5681,7 @@
|
|
|
5551
5681
|
/**
|
|
5552
5682
|
* @stable
|
|
5553
5683
|
*/
|
|
5554
|
-
var /** @type {?} */ VERSION = new _angular_core.Version('3.4.
|
|
5684
|
+
var /** @type {?} */ VERSION = new _angular_core.Version('3.4.10');
|
|
5555
5685
|
|
|
5556
5686
|
var /** @type {?} */ __router_private__ = {
|
|
5557
5687
|
ROUTER_PROVIDERS: ROUTER_PROVIDERS,
|