From f941c716039943ceac9a37a22ba93d8afc1d5e9d Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 16 Oct 2016 13:14:27 +0100 Subject: [PATCH] feat(upgrade): Dedicated NgMetadataUpgradeAdapter bootstrap function (#160) --- src/upgrade/upgrade_adapter.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/upgrade/upgrade_adapter.ts b/src/upgrade/upgrade_adapter.ts index 59a81a0..c009cc1 100644 --- a/src/upgrade/upgrade_adapter.ts +++ b/src/upgrade/upgrade_adapter.ts @@ -1,4 +1,5 @@ import { reflector } from '../core/reflection/reflection'; +import { createBootstrapFn } from '../platform/browser_utils'; import { getInjectableName, OpaqueToken } from '../core/di'; import { ProviderLiteral } from '../core/di/provider_util'; import { resolveDirectiveNameFromSelector } from '../facade/lang'; @@ -34,10 +35,20 @@ export interface UpgradeAdapter { export class NgMetadataUpgradeAdapter { + bootstrap: Function; + /** * Store a reference to the instantiated upgradeAdapter */ - constructor( public _upgradeAdapter: UpgradeAdapterInstance ) {} + constructor( public _upgradeAdapter: UpgradeAdapterInstance ) { + /** + * Used to bootstrap a hybrid Angular 1 and Angular 2 application, + * it is called with a single ng-metadata NgModule + * + * E.g. `upgradeAdapter.bootstrap(NgModule)` + */ + this.bootstrap = createBootstrapFn(this._upgradeAdapter.bootstrap.bind(this._upgradeAdapter)); + } /** * Used to register an Angular 2 component as a directive on an Angular 1 module,