/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ApplicationRef, ComponentFactoryResolver, ModuleWithProviders, NgModule, Inject, forwardRef, Type } from '@angular/core'; import { APP_BASE_HREF, CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService'; import { BackupComponent, BACKUP_SELECTOR } from 'sql/parts/disasterRecovery/backup/backup.component'; // work around const BrowserAnimationsModule = (require.__$__nodeRequire('@angular/platform-browser/animations')).BrowserAnimationsModule; // Backup wizard main angular module export const BackupModule = (params: IBootstrapParams, selector: string): Type => { @NgModule({ declarations: [ BackupComponent ], entryComponents: [BackupComponent], imports: [ FormsModule, CommonModule, BrowserModule, BrowserAnimationsModule, ], providers: [ { provide: APP_BASE_HREF, useValue: '/' }, { provide: IBootstrapParams, useValue: params } ] }) class ModuleClass { constructor( @Inject(forwardRef(() => ComponentFactoryResolver)) private _resolver: ComponentFactoryResolver ) { } ngDoBootstrap(appRef: ApplicationRef) { const factory = this._resolver.resolveComponentFactory(BackupComponent); (factory).factory.selector = selector; appRef.bootstrap(factory); } } return ModuleClass; };