tabby/app/src/app.module.ts

32 lines
852 B
TypeScript
Raw Normal View History

2016-12-23 09:06:53 +00:00
import { NgModule } from '@angular/core'
2017-04-15 13:20:18 +00:00
import { BrowserModule } from '@angular/platform-browser'
2016-12-23 09:06:53 +00:00
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
2018-01-19 14:31:28 +00:00
import { ToastrModule } from 'ngx-toastr'
2016-12-23 09:06:53 +00:00
2017-08-13 12:13:04 +00:00
export function getRootModule (plugins: any[]) {
2017-04-15 13:20:18 +00:00
let imports = [
BrowserModule,
2017-11-26 21:14:46 +00:00
...plugins,
2017-04-15 13:20:18 +00:00
NgbModule.forRoot(),
2018-01-19 14:31:28 +00:00
ToastrModule.forRoot({
positionClass: 'toast-bottom-center',
preventDuplicates: true,
extendedTimeOut: 5000,
}),
2017-04-15 13:20:18 +00:00
]
let bootstrap = [
...(plugins.filter(x => x.bootstrap).map(x => x.bootstrap)),
]
2017-03-23 20:42:00 +00:00
2017-05-01 11:35:26 +00:00
if (bootstrap.length === 0) {
2017-04-17 12:57:22 +00:00
throw new Error('Did not find any bootstrap components. Are there any plugins installed?')
}
2017-04-15 13:20:18 +00:00
@NgModule({
imports,
bootstrap,
}) class RootModule { }
2017-04-11 00:22:48 +00:00
2017-04-15 13:20:18 +00:00
return RootModule
}