-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
As seen in the stackblitz reproduction of the issue default options provided with [(ngModel)]
through a model()
are not applied to inputs (mat-chip-listbox
, mat-checkbox
, mat-select
, matInput
) inside a component projected through the router-outlet
if the app is set up with withComponentInputBinding()
.
This isn't the case with variable and reactive control binding, and it isn't the case if the input is outside of the router-outlet.
I don't know if the issue was present in earlier Angular/Material versions.
It looks like the issue is present in both zoneless and zone based settings, and regardless of the ChangeDetectionStrategy.
Reproduction
StackBlitz link: https://stackblitz.com/edit/angular-ikly5d7d?file=package.json,src%2Fmain.ts,src%2Findex.html
Expected Behavior
The inputs should be populated with the default option regardless if they are in a router-outlet or not.
Actual Behavior
Something sets the models to undefined in the process.
Environment
- Angular: 20.3.2
- CDK/Material: 20.2.5
- Browser(s): Google Chrome 140.0.7
- Operating System (e.g. Windows, macOS, Ubuntu): Windows