mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-21 04:20:11 -04:00
* change services to be individually injected into angular * messing around with injection * change angular bootstrapping to factory style * formatting * formatting * fix imports * fix build errors * fix testsw * fix tests * fix compile errors
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* 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 = (<any>require.__$__nodeRequire('@angular/platform-browser/animations')).BrowserAnimationsModule;
|
|
|
|
// Backup wizard main angular module
|
|
export const BackupModule = (params: IBootstrapParams, selector: string): Type<any> => {
|
|
@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);
|
|
(<any>factory).factory.selector = selector;
|
|
appRef.bootstrap(factory);
|
|
}
|
|
}
|
|
|
|
return ModuleClass;
|
|
};
|