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

NbDialogService has problem with inputSignal and ModelSignal #3256

Open
1 of 2 tasks
Akxe opened this issue May 29, 2024 · 0 comments · May be fixed by #3278
Open
1 of 2 tasks

NbDialogService has problem with inputSignal and ModelSignal #3256

Akxe opened this issue May 29, 2024 · 0 comments · May be fixed by #3278

Comments

@Akxe
Copy link

Akxe commented May 29, 2024

Issue type

I'm submitting a ...

  • bug report
  • feature request

Issue description

Current behavior:

this.dialogService.open(OrderDetailComponent, {
	closeOnBackdropClick: false,
	context: {
		// Error: TS2322: Type 'Order' is not assignable to type 'InputSignal<Order> | undefined'
		data: data,
	},
});

Expected behavior:
The input model should be updated, not tried to be replaced by new value

Steps to reproduce:

  1. Create a component with inputSignal (input.required());
  2. Open the component with context specifying our inputSignal

Related code:

@Component(...)
class MyDialogComponent {
  data = input.required<string>();
}

@Component(...)
class MyParentComponent {
  private readonly dialogService = inject(NbDialogService);


  onCreate(): void {
    this.dialogService.open(MyDialogComponent , {
      context: {
        data: 'test',
      },
    });
  }
}

Other information:

npm, node, OS, Browser

Node: v20.12.2
System: Win11

Angular, Nebular

Angular: 17
Nebular: 13
junglerobba added a commit to junglerobba/nebular that referenced this issue Jan 31, 2025
This makes an exception for input and model signals in the DialogConfig
context, so the typehint will show as the type of the signal's value,
but internally it will create a signal with the passed value.
Technically these will just be readonly signals instead of input or model
signals, but since components used as a dialog do not support regular
outputs anyway, it should not matter. When used in a regular context the
input signal will not be overwritten and work as usual.

closes akveo#3256
(I would not classify this as a bug but a missing feature instead)
junglerobba added a commit to junglerobba/nebular that referenced this issue Jan 31, 2025
This makes an exception for input and model signals in the DialogConfig
context, so the typehint will show as the type of the signal's value,
but internally it will create a signal with the passed value.
Technically these will just be readonly signals instead of input or model
signals, but since components used as a dialog do not support regular
outputs anyway, it should not matter. When used in a regular context the
input signal will not be overwritten and work as usual.

closes akveo#3256
(I would not classify this as a bug but a missing feature instead)
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 a pull request may close this issue.

1 participant