Skip to content

Commit

Permalink
fix: remove legacy dynamic component registration
Browse files Browse the repository at this point in the history
Pascal Iske committed Feb 26, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7810dd5 commit 82acab0
Showing 8 changed files with 9 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/app/components/copy/copy.module.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { SharedModule } from '../../shared/shared.module'
import { CopyComponent } from './copy.component'

@NgModule({
imports: [SharedModule.registerDynamicComponents([CopyComponent])],
imports: [SharedModule],
declarations: [CopyComponent],
exports: [CopyComponent],
})
12 changes: 1 addition & 11 deletions src/app/components/headlines/headlines.module.ts
Original file line number Diff line number Diff line change
@@ -9,17 +9,7 @@ import { HeadlineH5Component } from './headline-h5/headline-h5.component'
import { HeadlineH6Component } from './headline-h6/headline-h6.component'

@NgModule({
imports: [
SharedModule.registerDynamicComponents([
HeadlineH1Component,
HeadlineH2Component,
HeadlineH3Component,
HeadlineH4Component,
HeadlineH5Component,
HeadlineH6Component,
]),
IconModule,
],
imports: [SharedModule, IconModule],
declarations: [
HeadlineH1Component,
HeadlineH2Component,
2 changes: 1 addition & 1 deletion src/app/components/icon/icon.module.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { SharedModule } from '../../shared/shared.module'
import { IconComponent } from './icon.component'

@NgModule({
imports: [FontAwesomeModule, SharedModule.registerDynamicComponents([IconComponent])],
imports: [FontAwesomeModule, SharedModule],
declarations: [IconComponent],
exports: [IconComponent],
})
2 changes: 1 addition & 1 deletion src/app/components/link/link.module.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import { IconModule } from '../icon/icon.module'
import { LinkComponent } from './link.component'

@NgModule({
imports: [RouterModule, SharedModule.registerDynamicComponents([LinkComponent]), IconModule],
imports: [RouterModule, SharedModule, IconModule],
declarations: [LinkComponent],
exports: [LinkComponent],
})
7 changes: 1 addition & 6 deletions src/app/components/page-header/page-header.module.ts
Original file line number Diff line number Diff line change
@@ -6,12 +6,7 @@ import { CopyModule } from '../copy/copy.module'
import { PageHeaderComponent } from './page-header.component'

@NgModule({
imports: [
SharedModule.registerDynamicComponents([PageHeaderComponent]),
SectionModule,
HeadlinesModule,
CopyModule,
],
imports: [SharedModule, SectionModule, HeadlinesModule, CopyModule],
declarations: [PageHeaderComponent],
exports: [PageHeaderComponent],
})
6 changes: 1 addition & 5 deletions src/app/components/quick-contact/quick-contact.module.ts
Original file line number Diff line number Diff line change
@@ -5,11 +5,7 @@ import { IconModule } from '../icon/icon.module'
import { QuickContactComponent } from './quick-contact.component'

@NgModule({
imports: [
SharedModule.registerDynamicComponents([QuickContactComponent]),
LinkModule,
IconModule,
],
imports: [SharedModule, LinkModule, IconModule],
declarations: [QuickContactComponent],
exports: [QuickContactComponent],
})
2 changes: 1 addition & 1 deletion src/app/components/section/section.module.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { SharedModule } from '../../shared/shared.module'
import { SectionComponent } from './section.component'

@NgModule({
imports: [SharedModule.registerDynamicComponents([SectionComponent])],
imports: [SharedModule],
declarations: [SectionComponent],
exports: [SectionComponent],
})
17 changes: 2 additions & 15 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgModule, ModuleWithProviders, ANALYZE_FOR_ENTRY_COMPONENTS } from '@angular/core'
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { NotificationsModule } from '@pascaliske/ngx-notifications'
import { MarkdownModule } from 'ngx-markdown'
@@ -7,17 +7,4 @@ import { MarkdownModule } from 'ngx-markdown'
imports: [CommonModule, NotificationsModule, MarkdownModule],
exports: [CommonModule, NotificationsModule, MarkdownModule],
})
export class SharedModule {
public static registerDynamicComponents(components: any[]): ModuleWithProviders {
return {
ngModule: SharedModule,
providers: [
{
provide: ANALYZE_FOR_ENTRY_COMPONENTS,
useValue: components,
multi: true,
},
],
}
}
}
export class SharedModule {}

0 comments on commit 82acab0

Please sign in to comment.