diff --git a/public/docs/_examples/upgrade-adapter/e2e-spec.ts b/public/docs/_examples/upgrade-adapter/e2e-spec.ts index 04270a0002..c0325bc4b3 100644 --- a/public/docs/_examples/upgrade-adapter/e2e-spec.ts +++ b/public/docs/_examples/upgrade-adapter/e2e-spec.ts @@ -94,9 +94,8 @@ describe('Upgrade Tests', function () { describe('Downgraded component with IO', function() { beforeAll(function () { + setProtractorToHybridMode(); browser.get('/index-downgrade-io.html'); - setProtractorToNg1Mode(); - waitForNg1AsyncBootstrap(); }); it('has inputs', function () { diff --git a/public/docs/_examples/upgrade-adapter/ts/app/downgrade-io/app.module.ts b/public/docs/_examples/upgrade-adapter/ts/app/downgrade-io/app.module.ts index a09db040d1..5c2b8699e9 100644 --- a/public/docs/_examples/upgrade-adapter/ts/app/downgrade-io/app.module.ts +++ b/public/docs/_examples/upgrade-adapter/ts/app/downgrade-io/app.module.ts @@ -1,33 +1,78 @@ +// import { NgModule } from '@angular/core'; +// import { BrowserModule } from '@angular/platform-browser'; + +// import { MainController } from './main.controller'; +// #docregion downgradecomponent +// import { HeroDetailComponent } from './hero-detail.component'; + +// #enddocregion downgradecomponent + +// @NgModule({ +// imports: [ BrowserModule ], +// declarations: [ HeroDetailComponent ] +// }) +// export class AppModule {} + +// import { UpgradeAdapter } from '@angular/upgrade'; + +// const upgradeAdapter = new UpgradeAdapter(AppModule); + +// #docregion downgradecomponent + +// angular.module('heroApp', []) +// .controller('MainController', MainController) +// .directive('heroDetail', upgradeAdapter.downgradeNg2Component(HeroDetailComponent)); + +// #enddocregion downgradecomponent + +// upgradeAdapter.bootstrap( +// document.querySelector('hero-app'), +// ['heroApp'], +// {strictDi: true} +// ); +// // #enddocregion bootstrap + + +declare var angular: any; import { NgModule } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; +import { UpgradeModule, downgradeComponent } from '@angular/upgrade/static'; import { MainController } from './main.controller'; + // #docregion downgradecomponent import { HeroDetailComponent } from './hero-detail.component'; // #enddocregion downgradecomponent - @NgModule({ - imports: [ BrowserModule ], - declarations: [ HeroDetailComponent ] + imports: [ + BrowserModule, + UpgradeModule + ], + declarations: [ + HeroDetailComponent + ], + entryComponents: [ + HeroDetailComponent + ] }) -export class AppModule {} - -import { UpgradeAdapter } from '@angular/upgrade'; - -const upgradeAdapter = new UpgradeAdapter(AppModule); - +export class AppModule { + ngDoBootstrap() {} +} // #docregion downgradecomponent angular.module('heroApp', []) .controller('MainController', MainController) - .directive('heroDetail', upgradeAdapter.downgradeNg2Component(HeroDetailComponent)); + .directive('heroDetail', downgradeComponent({ + component: HeroDetailComponent, + inputs: ['hero'], + outputs: ['deleted'] + })); // #enddocregion downgradecomponent -upgradeAdapter.bootstrap( - document.querySelector('hero-app'), - ['heroApp'], - {strictDi: true} -); -// #enddocregion bootstrap +platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => { + let upgrade = platformRef.injector.get(UpgradeModule); + upgrade.bootstrap(document.body, ['heroApp'], {strictDi: true}); +});