Skip to content

Ng 21#33

Open
rengert wants to merge 5 commits intodkreider:mainfrom
rengert:ng-21
Open

Ng 21#33
rengert wants to merge 5 commits intodkreider:mainfrom
rengert:ng-21

Conversation

@rengert
Copy link
Copy Markdown
Contributor

@rengert rengert commented Mar 19, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 19, 2026 21:24
@rengert rengert mentioned this pull request Mar 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ngx-loading-buttons for a newer Angular version and refactors directives/playground to use signal-based APIs.

Changes:

  • Bumps Angular/tooling dependencies (and TypeScript) in package.json.
  • Refactors MatBasicSpinnerDirective and MatGlowDirective to use input() + effect() and host class bindings.
  • Updates the playground component/template to use a signal<boolean> for saving.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
projects/ngx-loading-buttons/src/public-api.ts Switches public exports to named exports.
projects/ngx-loading-buttons/src/lib/mat-glow/mat-glow.directive.ts Migrates to signal inputs/effects and host bindings for classes/disabled state.
projects/ngx-loading-buttons/src/lib/mat-basic-spinner.directive.ts Migrates to signal inputs/effects and host bindings for classes/disabled state.
projects/ngx-loading-buttons-playground/src/app/app.component.ts Converts saving to a signal and updates click handler accordingly.
projects/ngx-loading-buttons-playground/src/app/app.component.html Updates bindings to call saving() in templates.
package.json Updates Angular/dev tooling versions for the upgrade.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 3 to 9
@Directive({
selector: '[mtBasicSpinner]',
standalone: true,
host: {
'[class.mat-spinner]': 'mtBasicSpinner()',
'[class.hide-btn-text]': 'hideText() && mtBasicSpinner()',
},
})
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NgxLoadingButtonsModule currently imports MatBasicSpinnerDirective as a standalone directive (see projects/ngx-loading-buttons/src/lib/ngx-loading-buttons.module.ts:6-13). This directive no longer sets standalone: true, so the module (and any consumer importing the directive directly) will fail to compile. Either restore standalone: true here, or update the module to declare/export the directive via declarations instead of imports.

Copilot uses AI. Check for mistakes.
Comment on lines 3 to 9
@Directive({
selector: '[mtGlow]',
standalone: true,
host: {
'[class.mat-glow]': 'mtGlow()',
'[class.hide-btn-text]': 'hideText() && mtGlow()',
}
})
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NgxLoadingButtonsModule currently imports MatGlowDirective as a standalone directive (see projects/ngx-loading-buttons/src/lib/ngx-loading-buttons.module.ts:6-13). This directive no longer sets standalone: true, so the module (and any consumer importing the directive directly) will fail to compile. Either restore standalone: true here, or update the module to declare/export the directive via declarations instead of imports.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +17
constructor(elem: ElementRef<HTMLButtonElement>) {
effect(() => {
elem.nativeElement.disabled = this.mtBasicSpinner();
});
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directive now uses effect() in the constructor. effect() must run inside an Angular injection context, so tests (and any code) that instantiate the directive via new MatBasicSpinnerDirective(...) will throw at runtime. Update tests/usage to create the directive via TestBed/template instantiation (or wrap construction in runInInjectionContext).

Copilot uses AI. Check for mistakes.
Comment on lines 11 to +17
title = 'ngx-loading-buttons-playground';
saving = false;
saving = signal(false);
color = "blue";

click(): void {
this.saving = true;
setTimeout(() => this.saving = false, 3000);
this.saving.set(true);
setTimeout(() => this.saving.set(false), 3000);
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saving was changed from a boolean to a signal<boolean>, but the existing directive unit test (projects/ngx-loading-buttons/src/lib/mat-basic-spinner.directive.spec.ts) assigns fixture.componentInstance.saving = true/false and relies on it being a boolean. Update the test (and any other consumers) to use saving.set(...) (or switch the test component back to a boolean) to avoid failing CI.

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +22
constructor(elem: ElementRef<HTMLButtonElement>) {
effect(() => {
document.documentElement.style.setProperty('--glow-color', this.glowColor());
});
effect(() => {
elem.nativeElement.disabled = this.mtGlow();
});
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directive now uses effect() in the constructor. effect() must run inside an Angular injection context, so any tests/usage that instantiate the directive via new MatGlowDirective(...) will throw at runtime. Ensure the directive is created via template/TestBed (or wrap construction in runInInjectionContext).

Copilot uses AI. Check for mistakes.
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.

2 participants