Open
Description
Feature Description
Currently, to access data inside a material component, and treat it as a signal, we have to inject MAT_DIALOG_DATA and get the data like this:
import { MAT_DIALOG_DATA } from '@angular/components/dialog';
data =signal( inject(MAT_DIALOG_DATA)) // create signal from input data
ngOnInit() {
// Do something with the data
}
Proposal:
Create a new function that injects MAT_DIALOG_DATA for us, and returns the injected data as a signal:
import { dialogData } from '@angular/material/dialog' // new function
data = dialogData(); // data is now a signal
doSomething = effect( () => dosomethingWithhdata( this.data());
Use Case
Having data inputs for dialogs handled in the same way as regular components, and having the inputs available as signals without needing the boilerplate code we currently need to do.
Having inputs as signals also lets us avoid using ngOnInit and constructors because it lets us use effect() to initiate actions