update downgrade-static
This commit is contained in:
parent
2117d40de3
commit
e4bb6ce3cc
|
@ -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 () {
|
||||
|
|
|
@ -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});
|
||||
});
|
||||
|
|
|
@ -8,6 +8,4 @@ import { Component } from '@angular/core';
|
|||
<div><label>id: </label>1</div>
|
||||
`
|
||||
})
|
||||
export class HeroDetailComponent {
|
||||
|
||||
}
|
||||
export class HeroDetailComponent { }
|
||||
|
|
Loading…
Reference in New Issue