-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Angular: signal-based inputs not working #2950
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
Comments
GridStack ng wrapper was written long before Angular had signal inputs (based on code I wrote 8 years ago when I first started using the legacy jquery UI based js gridstack) and breaks due to this simple code. BaseWidget.deserialize(w: NgGridStackWidget) {
...
if (w.input) Object.assign(this, w.input);
} All my code still uses |
please provide working example (as bug report mentions) Steps to reproduceYou MUST provide a working demo - keep it simple and avoid frameworks as that could have issues - you can use |
Here is an example: |
I tested your example, and with your current implementation you can still render the title like this: <div>Title: {{ title }}</div> Under the hood, Angular’s if (w.input) Object.assign(this, w.input); If A simple workaround is to wrap your raw signal in a computed and invoke that in the template: export class SignalBasedComponent extends BaseWidget {
title = input<string>();
computedTitle = computed(() => this.title);
} <!-- No warning, because computedTitle() is a function call -->
Title: {{ computedTitle() }}
<!-- Still works but raises NG8109 -->
Title with warning: {{ title }} |
Hello,
There is an option to pass input fields in an
NgGridStackWidget
:This data however can only be access by using the
@Input
decorator. A signal-based approach does not work.According to the documentation binding should be same:
But using something like
value = input<number>();
ifvalue
was passed viainput
ofNgGridStackWidget
will result invalue
being a number rather than a signal. So, trying to access the value as a signal (e.g.The slider's value is ${this.value()}
) will result in an error.Regards
The text was updated successfully, but these errors were encountered: