angular / angular/components

form-field(select): with matNativeControl and outline where one field relies upon the value of another

Open
#16,229 1 comment 3 reactions 0 assignees View on GitHub
area: material/form-field area: material/select P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Reproduction

Open StackBlitz, and try to select different options, open dev tools and see errors: https://angular-jjb9g7.stackblitz.io

Steps to reproduce:
1. Add two `mat-form-field` with `appearance="outline"`
2. Add `` to each one
3. Make that second field select dynamically get options after first field value changed


#### Expected Behavior

First field changes value and second field get new options

#### Actual Behavior
First field changes value and second field get new options and errors at console are shown:
```ts
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
Previous value: 'mat-form-field-should-float: false'.
Current value: 'mat-form-field-should-float: true'.
```

#### P.S. If delete appearance="outline", no errors are shown.

#### Environment

- Angular: 7.2.0
- Material: 7.3.7 and 8.2.3
- Browser(Chrome Version 74.0.3729.108 (Official Build) (64-bit)):
- Operating System (Ubuntu 18.04):

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and inspect the two outlined mat-form-field elements using matNativeControl. Reproduce the dependent select update while watching the console for ExpressionChangedAfterItHasBeenCheckedError. Done means the second field updates after the first changes without the reported error, while retaining outline appearance.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.