Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Modernizes dependency injection across all 24 components in the time-planning plugin to use Angular's inject() function instead of constructor-based injection, following the pattern established in the backend configuration plugin.

Changes

  • Dependency injection migration: Converted constructor parameters to field-level inject() calls
  • @Inject token migration: Replaced @Inject(TOKEN) decorator pattern with inject<Type>(TOKEN)
  • Constructor cleanup: Removed all constructors; moved initialization logic to ngOnInit() where needed
  • Access modifiers preserved: Maintained public/private visibility as originally specified

Migration Pattern

Before:

constructor(
  private service: TimePlanningPnSettingsService,
  @Inject(MAT_DIALOG_DATA) public data: AssignedSiteModel,
  private store: Store
) {
  this.previousData = {...data};
}

After:

private service = inject(TimePlanningPnSettingsService);
public data = inject<AssignedSiteModel>(MAT_DIALOG_DATA);
private store = inject(Store);

ngOnInit(): void {
  this.previousData = {...this.data};
}

Components Migrated (24)

  • Settings (1): time-planning-settings
  • Plannings (6): container, table, assigned-site dialog, download-excel dialog, workday-entity dialog
  • Layout (1): time-planning-pn-layout
  • Registration devices (6): create/edit/delete modals, OTP code, container, table
  • Flexes (4): comment office modals, container, table
  • Working hours (7): mobile view, comment office modals, upload modal, container, header, table
Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate all components from constructor-based DI to inject() pattern</issue_title>
<issue_description>Use this PR as reference for all the parts that needs to be taken into consideration when doing the migration microting/eform-backendconfiguration-plugin#608</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Migrate all components from constructor-based DI to inject() pattern Migrate all components from constructor-based DI to inject() pattern Nov 28, 2025
Copilot AI requested a review from renemadsen November 28, 2025 14:17
Copilot finished work on behalf of renemadsen November 28, 2025 14:17
@renemadsen renemadsen marked this pull request as ready for review November 28, 2025 15:01
@renemadsen renemadsen merged commit 562f0d5 into master Nov 28, 2025
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate all components from constructor-based DI to inject() pattern

2 participants