test(ngUpgrade): convert the upgrade example to use NgModules

The example worked even before this change - verifying that the fallback/legacy mode works as well.
This commit is contained in:
Igor Minar 2016-08-03 17:44:48 -07:00 committed by Misko Hevery
parent 5dab0bad3c
commit 37f138e83d
1 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {Component, EventEmitter, Input, Output} from '@angular/core'; import {Component, EventEmitter, Input, NgModule, Output} from '@angular/core';
import {UpgradeAdapter} from '@angular/upgrade'; import {UpgradeAdapter} from '@angular/upgrade';
declare var angular: any; declare var angular: any;
@ -26,7 +26,7 @@ var styles = [`
} }
`]; `];
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter(Ng2AppModule);
var ng1module = angular.module('myExample', []); var ng1module = angular.module('myExample', []);
@ -76,6 +76,12 @@ class UpgradeApp {
constructor() {} constructor() {}
} }
@NgModule({
declarations: [Pane, UpgradeApp],
entryComponents: [UpgradeApp]
})
class Ng2AppModule {}
ng1module.directive('upgradeApp', adapter.downgradeNg2Component(UpgradeApp)); ng1module.directive('upgradeApp', adapter.downgradeNg2Component(UpgradeApp));
export function main() { export function main() {