Description
Feature Description
Currently if there is a dialog which is meant to be used with a specific width, height, autoFocus, disableClose, etc... each and every code that opens that dialog need to specify those values. Even if extracted to a const you still need to remember to pass it.
What I wish to have is the ability to specify on the dialog component itself those configuration options or at least some of them that make sense. Allowing to actually "declare" to the one using - If you pass nothing in the open
function config - this is the recommended and default config for this specific dialog. If you do pass a config object it overrides the recommended one.
Use Case
When having a dialog that needs for example to have autoFocus
as false always as it handles it inside - everyone using that dialog has to remember to declare this specific config when opening otherwise the dialog won't work as expected. Even if it was extracted to a const - the one opening the dialog still needs to know that const exists and remember to pass it.
The suggestion allows the dialog creator to specify the default config.
Activity
crisbeto commentedon Oct 17, 2022
We have the
MAT_DIALOG_DEFAULT_OPTIONS
injection token that allows you to configure the defaults for the dialog. Is this what you're looking for?Harpush commentedon Oct 17, 2022
Unfortunately no... The idea is per component basis. So the component author can specify it. The injection token you mentioned can only be specified from outside the dialog as far as I know. The main idea is the component author should know best what fits the dialog (in most cases) and should provide a default on the component itself and not from outside.
Harpush commentedon Jan 15, 2023
@crisbeto Any news concerning this?