From e4bb6ce3cc5af3f1c4b8a3186e974a875d81e106 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 10 Nov 2016 12:24:20 +0000 Subject: [PATCH] update downgrade-static --- .../_examples/upgrade-adapter/e2e-spec.ts | 3 +- .../ts/app/downgrade-static/app.module.ts | 35 +++++++++++-------- .../downgrade-static/hero-detail.component.ts | 4 +-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/public/docs/_examples/upgrade-adapter/e2e-spec.ts b/public/docs/_examples/upgrade-adapter/e2e-spec.ts index 2994022c72..04270a0002 100644 --- a/public/docs/_examples/upgrade-adapter/e2e-spec.ts +++ b/public/docs/_examples/upgrade-adapter/e2e-spec.ts @@ -81,9 +81,8 @@ describe('Upgrade Tests', function () { describe('Downgraded static component', function() { beforeAll(function () { + setProtractorToHybridMode(); browser.get('/index-downgrade-static.html'); - setProtractorToNg1Mode(); - waitForNg1AsyncBootstrap(); }); it('renders', function () { diff --git a/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/app.module.ts b/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/app.module.ts index d5f173b5b5..0c9d2612fa 100644 --- a/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/app.module.ts +++ b/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/app.module.ts @@ -1,30 +1,37 @@ +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'; // #docregion downgradecomponent, ngmodule import { HeroDetailComponent } from './hero-detail.component'; // #enddocregion downgradecomponent @NgModule({ - imports: [ BrowserModule ], - declarations: [ HeroDetailComponent ] + imports: [ + BrowserModule, + UpgradeModule + ], + declarations: [ + HeroDetailComponent + ], + entryComponents: [ + HeroDetailComponent + ] }) -export class AppModule {} +export class AppModule { + ngDoBootstrap() {} +} // #enddocregion ngmodule -import { UpgradeAdapter } from '@angular/upgrade'; - -const upgradeAdapter = new UpgradeAdapter(AppModule); - // #docregion downgradecomponent angular.module('heroApp', []) - .directive('heroDetail', upgradeAdapter.downgradeNg2Component(HeroDetailComponent)); + .directive('heroDetail', downgradeComponent({component: HeroDetailComponent})); // #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}); +}); diff --git a/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/hero-detail.component.ts b/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/hero-detail.component.ts index cbcadfbd5a..df4a705f37 100644 --- a/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/hero-detail.component.ts +++ b/public/docs/_examples/upgrade-adapter/ts/app/downgrade-static/hero-detail.component.ts @@ -8,6 +8,4 @@ import { Component } from '@angular/core';
1
` }) -export class HeroDetailComponent { - -} +export class HeroDetailComponent { }