I wanted to set the title dynamically. It seems it's not possible when calling this.dialog(data) and it was not possible to create the dialog just before opening it, because it's not during an injection context, so if I am not wrong, this must stay in the properties.
In my case it works, but that need to paste a lot of code. I think that could be great feature to be able to be able to override the TuiDialogOptions when calling the dialog. That could be a parameter that would be at the same place of my title.
If you want I could ty to create a pull request with the changes. Just let me know.
Description
Hello,
I'm new to taiga ui, so if that's something that is already available let me know and I'll close this issue.
Problem
I was using a dialog with a component for a case where I open it multiple time.
The modal is created like this:
And opened like this
I wanted to set the title dynamically. It seems it's not possible when calling
this.dialog(data)
and it was not possible to create the dialog just before opening it, because it's not during an injection context, so if I am not wrong, this must stay in the properties.My solution
I copied and pasted a lot of code from the dialog factory file: https://github.com/taiga-family/taiga-ui/blob/main/projects/core/components/dialog/dialog.factory.ts
I created a custom
tuiDialog
method, insted of returning(data: D) => Observable<R>
it return(data: D,title:string) => Observable<R>
Now it's:
And opened like this
Proposition
In my case it works, but that need to paste a lot of code. I think that could be great feature to be able to be able to override the
TuiDialogOptions
when calling the dialog. That could be a parameter that would be at the same place of my title.If you want I could ty to create a pull request with the changes. Just let me know.