40 lines
1.1 KiB
TypeScript
Raw Normal View History

declare var angular: angular.IAngularStatic;
2016-11-10 14:04:35 +00:00
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 { heroDetail, HeroDetailDirective } from './hero-detail.component';
import { ContainerComponent } from './container.component';
2016-11-10 14:04:35 +00:00
// #docregion heroupgrade
@NgModule({
imports: [
BrowserModule,
UpgradeModule
],
declarations: [
ContainerComponent,
HeroDetailDirective
2016-11-10 14:04:35 +00:00
],
entryComponents: [
ContainerComponent
]
})
export class AppModule {
ngDoBootstrap() {}
}
// #enddocregion heroupgrade
angular.module('heroApp', [])
2016-11-10 14:04:35 +00:00
.component('heroDetail', heroDetail)
.directive(
'myContainer',
downgradeComponent({component: ContainerComponent}) as angular.IDirectiveFactory
);
2016-11-10 14:04:35 +00:00
platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => {
2016-11-14 19:02:54 +00:00
const upgrade = platformRef.injector.get(UpgradeModule) as UpgradeModule;
2016-11-10 14:04:35 +00:00
upgrade.bootstrap(document.body, ['heroApp'], {strictDi: true});
});