feat(router): export provideRouter via index
This commit is contained in:
parent
40a06af79b
commit
91d64a2855
|
@ -0,0 +1,2 @@
|
|||
import { RouterConfig } from './config';
|
||||
export declare function provideRouter(config: RouterConfig): any[];
|
|
@ -0,0 +1,30 @@
|
|||
import { RouterOutletMap } from './router_outlet_map';
|
||||
import { UrlSerializer, DefaultUrlSerializer } from './url_serializer';
|
||||
import { ActivatedRoute } from './router_state';
|
||||
import { Router } from './router';
|
||||
import { ComponentResolver, ApplicationRef } from '@angular/core';
|
||||
import { LocationStrategy, PathLocationStrategy, Location } from '@angular/common';
|
||||
export function provideRouter(config) {
|
||||
return [
|
||||
Location,
|
||||
{ provide: LocationStrategy, useClass: PathLocationStrategy },
|
||||
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
||||
{
|
||||
provide: Router,
|
||||
useFactory: (ref, resolver, urlSerializer, outletMap, location) => {
|
||||
if (ref.componentTypes.length == 0) {
|
||||
throw new Error("Bootstrap at least one component before injecting Router.");
|
||||
}
|
||||
const componentType = ref.componentTypes[0];
|
||||
const r = new Router(componentType, resolver, urlSerializer, outletMap, location);
|
||||
r.resetConfig(config);
|
||||
ref.registerDisposeListener(() => r.dispose());
|
||||
return r;
|
||||
},
|
||||
deps: [ApplicationRef, ComponentResolver, UrlSerializer, RouterOutletMap, Location]
|
||||
},
|
||||
RouterOutletMap,
|
||||
{ provide: ActivatedRoute, useFactory: (r) => r.routerState.root, deps: [Router] },
|
||||
];
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uX3JvdXRlcl9wcm92aWRlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbW9uX3JvdXRlcl9wcm92aWRlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ik9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxxQkFBcUI7T0FDOUMsRUFBRSxhQUFhLEVB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HlwZXNbMF07XG4gICAgICAgIGNvbnN0IHIgPSBuZXcgUm91dGVyKGNvbXBvbmVudFR5cGUsIHJlc29sdmVyLCB1cmxTZXJpYWxpemVyLCBvdXRsZXRNYXAsIGxvY2F0aW9uKTtcbiAgICAgICAgci5yZXNldENvbmZpZyhjb25maWcpO1xuICAgICAgICByZWYucmVnaXN0ZXJEaXNwb3NlTGlzdGVuZXIoKCkgPT4gci5kaXNwb3NlKCkpO1xuICAgICAgICByZXR1cm4gcjtcbiAgICAgIH0sXG4gICAgICBkZXBzOiBbQXBwbGljYXRpb25SZWYsIENvbXBvbmVudFJlc29sdmVyLCBVcmxTZXJpYWxpemVyLCBSb3V0ZXJPdXRsZXRNYXAsIExvY2F0aW9uXVxuICAgIH0sXG5cbiAgICBSb3V0ZXJPdXRsZXRNYXAsXG4gICAge3Byb3ZpZGU6IEFjdGl2YXRlZFJvdXRlLCB1c2VGYWN0b3J5OiAocikgPT4gci5yb3V0ZXJTdGF0ZS5yb290LCBkZXBzOiBbUm91dGVyXX0sXG4gIF07XG59XG4iXX0=
|
|
@ -5,6 +5,7 @@ export { UrlTree, UrlSegment } from './url_tree';
|
|||
export { RouterOutletMap } from './router_outlet_map';
|
||||
export { RouterConfig, Route } from './config';
|
||||
export { Params, PRIMARY_OUTLET } from './shared';
|
||||
export { provideRouter } from './router_providers';
|
||||
import { RouterOutlet } from './directives/router_outlet';
|
||||
import { RouterLink } from './directives/router_link';
|
||||
export declare const ROUTER_DIRECTIVES: (typeof RouterOutlet | typeof RouterLink)[];
|
||||
|
|
|
@ -4,7 +4,8 @@ export { RouterState, ActivatedRoute } from './router_state';
|
|||
export { UrlTree, UrlSegment } from './url_tree';
|
||||
export { RouterOutletMap } from './router_outlet_map';
|
||||
export { PRIMARY_OUTLET } from './shared';
|
||||
export { provideRouter } from './router_providers';
|
||||
import { RouterOutlet } from './directives/router_outlet';
|
||||
import { RouterLink } from './directives/router_link';
|
||||
export const ROUTER_DIRECTIVES = [RouterOutlet, R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iOlsiZXhwb3J0IHsgUm91dGVyIH0gZnJvbSAnLi9yb3V0ZXInO1xuZXhwb3J0IHsgVXJsU2VyaWFsaXplciwgRGVmYXVsdFVybFNlcmlhbGl6ZXIgfSBmcm9tICcuL3VybF9zZXJpYWxpemVyJztcbmV4cG9ydCB7IFJvdXRlclN0YXRlLCBBY3RpdmF0ZWRSb3V0ZSB9IGZyb20gJy4vcm91dGVyX3N0YXRlJztcbmV4cG9ydCB7IFVybFRyZWUsIFVybFNlZ21lbnR9IGZyb20gJy4vdXJsX3RyZWUnO1xuZXhwb3J0IHsgUm91dGVyT3V0bGV0TWFwIH0gZnJvbSAnLi9yb3V0ZXJfb3V0bGV0X21hcCc7XG5leHBvcnQgeyBSb3V0ZXJDb25maWcsIFJvdXRlIH0gZnJvbSAnLi9jb25maWcnO1xuZXhwb3J0IHsgUGFyYW1zLCBQUklNQVJZX09VVExFVCB9IGZyb20gJy4vc2hhcmVkJztcbmV4cG9ydCB7IHByb3ZpZGVSb3V0ZXIgfSBmcm9tICcuL3JvdXRlcl9wcm92aWRlcnMnO1xuXG5pbXBvcnQgeyBSb3V0ZXJPdXRsZXQgfSBmcm9tICcuL2RpcmVjdGl2ZXMvcm91dGVyX291dGxldCc7XG5pbXBvcnQgeyBSb3V0ZXJMaW5rIH0gZnJvbSAnLi9kaXJlY3RpdmVzL3JvdXRlcl9saW5rJztcblxuZXhwb3J0IGNvbnN0IFJPVVRFUl9ESVJFQ1RJVkVTID0gW1JvdXRlck91dGxldCwgUm91dGVyTGlua107Il19
|
|
@ -0,0 +1,2 @@
|
|||
import { RouterConfig } from './config';
|
||||
export declare function provideRouter(config: RouterConfig): any[];
|
|
@ -0,0 +1,10 @@
|
|||
import * as common from './common_router_providers';
|
||||
import { BrowserPlatformLocation } from '@angular/platform-browser';
|
||||
import { PlatformLocation } from '@angular/common';
|
||||
export function provideRouter(config) {
|
||||
return [
|
||||
{ provide: PlatformLocation, useClass: BrowserPlatformLocation },
|
||||
...common.provideRouter(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mVjdGl2ZXM6IFtST1VURVJfRElSRUNUSVZFU119KVxuICogY2xhc3MgQXBwQ21wIHtcbiAqICAgLy8gLi4uXG4gKiB9XG4gKiBcbiAqIGNvbnN0IHJvdXRlciA9IFtcbiAqICAge3BhdGg6ICcvaG9tZScsIGNvbXBvbmVudDogSG9tZX1cbiAqIF07XG4gKlxuICogYm9vdHN0cmFwKEFwcENtcCwgW3Byb3ZpZGVSb3V0ZXIocm91dGVyKV0pO1xuICogYGBgXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBwcm92aWRlUm91dGVyKGNvbmZpZzogUm91dGVyQ29uZmlnKTphbnlbXSB7XG4gIHJldHVybiBbXG4gICAge3Byb3ZpZGU6IFBsYXRmb3JtTG9jYXRpb24sIHVzZUNsYXNzOiBCcm93c2VyUGxhdGZvcm1Mb2NhdGlvbn0sXG4gICAgLi4uY29tbW9uLnByb3ZpZGVSb3V0ZXIoY29uZmlnKVxuICBdO1xufVxuIl19
|
|
@ -0,0 +1,2 @@
|
|||
import { RouterConfig } from './config';
|
||||
export declare function provideRouter(config: RouterConfig): any[];
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
var router_outlet_map_1 = require('./router_outlet_map');
|
||||
var url_serializer_1 = require('./url_serializer');
|
||||
var router_state_1 = require('./router_state');
|
||||
var router_1 = require('./router');
|
||||
var core_1 = require('@angular/core');
|
||||
var common_1 = require('@angular/common');
|
||||
function provideRouter(config) {
|
||||
return [
|
||||
common_1.Location,
|
||||
{ provide: common_1.LocationStrategy, useClass: common_1.PathLocationStrategy },
|
||||
{ provide: url_serializer_1.UrlSerializer, useClass: url_serializer_1.DefaultUrlSerializer },
|
||||
{
|
||||
provide: router_1.Router,
|
||||
useFactory: function (ref, resolver, urlSerializer, outletMap, location) {
|
||||
if (ref.componentTypes.length == 0) {
|
||||
throw new Error("Bootstrap at least one component before injecting Router.");
|
||||
}
|
||||
var componentType = ref.componentTypes[0];
|
||||
var r = new router_1.Router(componentType, resolver, urlSerializer, outletMap, location);
|
||||
r.resetConfig(config);
|
||||
ref.registerDisposeListener(function () { return r.dispose(); });
|
||||
return r;
|
||||
},
|
||||
deps: [core_1.ApplicationRef, core_1.ComponentResolver, url_serializer_1.UrlSerializer, router_outlet_map_1.RouterOutletMap, common_1.Location]
|
||||
},
|
||||
router_outlet_map_1.RouterOutletMap,
|
||||
{ provide: router_state_1.ActivatedRoute, useFactory: function (r) { return r.routerState.root; }, deps: [router_1.Router] },
|
||||
];
|
||||
}
|
||||
exports.provideRouter = provideRouter;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uX3JvdXRlcl9wcm92aWRlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29tbW9uX3JvdXRlcl9wcm92aWRlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGtDQUFnQyxxQkFBcUIsQ0FBQyxDQUFBO0FBQ3RELCtCQUFvRCxrQkFBa0IsQ0FBQyxDQUFBO0FBQ3ZFLDZCQUErQixnQkFBZ0IsQ0FBQyxDQUFBO0FBQ2hELHVCQUF1QixVQUFVLENBQUMsQ0FBQTtBQUVsQyxxQkFBaUQsZUFBZSxDQUFDLENBQUE7QUFDakUsdUJBQWlFLGlCQUFpQixDQUFDLENBQUE7QUFvQm5GLHVCQUE4QixNQUFvQjtJQUNoRCxNQUFNLENBQUM7UUFDTCxpQkFBUTtRQUNSLEVBQUMsT0FBTyxFQUFFLHlCQUFnQixFQUFFLFFBQVEsRUFBRSw2QkFBb0IsRUFBQztRQUMzRCxFQUFDLE9BQU8sRUFBRSw4QkFBYSxFQUFFLFFBQVEsRUFBRSxxQ0FBb0IsRUFBQztRQUV4RDtZQUNFLE9BQU8sRUFBRSxlQUFNO1lBQ2YsVUFBVSxFQUFFLFVBQUMsR0FBRyxFQUFFLFFBQVEsRUFBRSxhQUFhLEVBQUUsU0FBUyxFQUFF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ocikgPT4gci5yb3V0ZXJTdGF0ZS5yb290LCBkZXBzOiBbUm91dGVyXX0sXG4gIF07XG59XG4iXX0=
|
|
@ -5,6 +5,7 @@ export { UrlTree, UrlSegment } from './url_tree';
|
|||
export { RouterOutletMap } from './router_outlet_map';
|
||||
export { RouterConfig, Route } from './config';
|
||||
export { Params, PRIMARY_OUTLET } from './shared';
|
||||
export { provideRouter } from './router_providers';
|
||||
import { RouterOutlet } from './directives/router_outlet';
|
||||
import { RouterLink } from './directives/router_link';
|
||||
export declare const ROUTER_DIRECTIVES: (typeof RouterOutlet | typeof RouterLink)[];
|
||||
|
|
|
@ -14,7 +14,9 @@ var router_outlet_map_1 = require('./router_outlet_map');
|
|||
exports.RouterOutletMap = router_outlet_map_1.RouterOutletMap;
|
||||
var shared_1 = require('./shared');
|
||||
exports.PRIMARY_OUTLET = shared_1.PRIMARY_OUTLET;
|
||||
var router_providers_1 = require('./router_providers');
|
||||
exports.provideRouter = router_providers_1.provideRouter;
|
||||
var router_outlet_1 = require('./directives/router_outlet');
|
||||
var router_link_1 = require('./directives/router_link');
|
||||
exports.ROUTER_DIRECTIVES = [router_outlet_1.RouterOutlet, router_link_1.RouterLink];
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHVCQUF1QixVQUFVLENBQUM7QUFBekIsaUNBQXlCO0FBQ2xDLCtCQUFvRCxrQkFBa0IsQ0FBQztBQUE5RCx1REFBYTtBQUFFLHFFQUErQztBQUN2RSw2QkFBNEMsZ0JBQWdCLENBQUM7QUFBcEQsaURBQVc7QUFBRSx1REFBdUM7QUFDN0QseUJBQW1DLFlBQVksQ0FBQztBQUF2QyxxQ0FBTztBQUFFLDJDQUE4QjtBQUNoRCxrQ0FBZ0MscUJBQXF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29uZmlnJztcbmV4cG9ydCB7IFBhcmFtcywgUFJJTUFSWV9PVVRMRVQgfSBmcm9tICcuL3NoYXJlZCc7XG5leHBvcnQgeyBwcm92aWRlUm91dGVyIH0gZnJvbSAnLi9yb3V0ZXJfcHJvdmlkZXJzJztcblxuaW1wb3J0IHsgUm91dGVyT3V0bGV0IH0gZnJvbSAnLi9kaXJlY3RpdmVzL3JvdXRlcl9vdXRsZXQnO1xuaW1wb3J0IHsgUm91dGVyTGluayB9IGZyb20gJy4vZGlyZWN0aXZlcy9yb3V0ZXJfbGluayc7XG5cbmV4cG9ydCBjb25zdCBST1VURVJfRElSRUNUSVZFUyA9IFtSb3V0ZXJPdXRsZXQsIFJvdXRlckxpbmtdOyJdfQ==
|
|
@ -0,0 +1,2 @@
|
|||
import { RouterConfig } from './config';
|
||||
export declare function provideRouter(config: RouterConfig): any[];
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
var common = require('./common_router_providers');
|
||||
var platform_browser_1 = require('@angular/platform-browser');
|
||||
var common_1 = require('@angular/common');
|
||||
function provideRouter(config) {
|
||||
return [
|
||||
{ provide: common_1.PlatformLocation, useClass: platform_browser_1.BrowserPlatformLocation }
|
||||
].concat(common.provideRouter(config));
|
||||
}
|
||||
exports.provideRouter = provideRouter;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX3Byb3ZpZGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yb3V0ZXJfcHJvdmlkZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxJQUFZLE1BQU0sV0FBTSwyQkFBMkIsQ0FBQyxDQUFBO0FBQ3BELGlDQUFzQywyQkFBMkIsQ0FBQyxDQUFBO0FBQ2xFLHVCQUErQixpQkFBaUIsQ0FBQyxDQUFBO0FBb0JqRCx1QkFBOEIsTUFBb0I7SUFDaEQsTUFB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gIHtwcm92aWRlOiBQbGF0Zm9ybUxvY2F0aW9uLCB1c2VDbGFzczogQnJvd3NlclBsYXRmb3JtTG9jYXRpb259LFxuICAgIC4uLmNvbW1vbi5wcm92aWRlUm91dGVyKGNvbmZpZylcbiAgXTtcbn1cbiJdfQ==
|
|
@ -5,6 +5,7 @@ export { UrlTree, UrlSegment} from './url_tree';
|
|||
export { RouterOutletMap } from './router_outlet_map';
|
||||
export { RouterConfig, Route } from './config';
|
||||
export { Params, PRIMARY_OUTLET } from './shared';
|
||||
export { provideRouter } from './router_providers';
|
||||
|
||||
import { RouterOutlet } from './directives/router_outlet';
|
||||
import { RouterLink } from './directives/router_link';
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"src/url_serializer.ts",
|
||||
"src/url_tree.ts",
|
||||
"src/shared.ts",
|
||||
"src/router_providers.ts",
|
||||
"src/create_url_tree.ts",
|
||||
"src/directives/router_outlet.ts",
|
||||
"src/directives/router_link.ts",
|
||||
|
|
Loading…
Reference in New Issue