Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorPickerService should be providedIn: 'root' #326

Open
jnizet opened this issue Jan 5, 2023 · 0 comments
Open

ColorPickerService should be providedIn: 'root' #326

jnizet opened this issue Jan 5, 2023 · 0 comments

Comments

@jnizet
Copy link

jnizet commented Jan 5, 2023

The only state of the service is the active color picker:

  private active: ColorPickerComponent | null = null;

  public setActive(active: ColorPickerComponent | null): void {
    if (this.active && this.active !== active && this.active.cpDialogDisplay !== 'inline') {
      this.active.closeDialog();
    }

    this.active = active;
  }

The intention of this code, as I understand it, is to have only one active color picker at once in the application. It doesn't make much sense to me to have one active color picker per lazy-loaded module. And if that was really desired, it would still be possible to explicitly add the service to the providers of each module.

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

No branches or pull requests

1 participant