mat-selection-list list-options is not updated when formControl for mat-selection-list is updated with setValue
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
#### What is the expected behavior?
Checkboxes should update
#### What is the current behavior?
Checkboxes do not update.
#### What are the steps to reproduce?
**editor.componenet.html**
```html
{{ role.attributes.name }}
```
**editor.component.ts (onInit)**
```javascript
this.form = this.fb.group({
role: [[...this.user.attributes.role], Validators.required],
});
```
`this.user.attributes.role` is an array of string.
**I tried**
**editor.component.ts**
```javascript
ngAfterContentInit() {
this.form.patchValue({
'role': [...this.user.attributes.role]
});
}
```
**I also tried**
**editor.component.ts**
```javascript
ngAfterContentInit() {
setTimeout(() => {
this.form.patchValue({
'role': [...this.user.attributes.role]
});
console.log(this.form.value.role);
}, 1000);
}
```
Note that I'm getting `roles` with an observable :
**editor.component.ts**
```javascript
combineLatest(
// Others observables ...
this.jsonApi.all('roles').pipe(map(document => document.data)),
).subscribe(([firms, langs, roles]) => {
// Others observables ...
this.roles = roles;
});
```
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 7.x.x
Material 7.x.x
#### Is there anything else we should know?
I know there's a [ticket](https://github.com/angular/material2/issues/9085) about this, but it's closed and no one replies
Guía de contribución
Línea de trabajo
Reproduce el problema usando editor.component.html y editor.component.ts con una Angular 7 mat-selection-list, roles asíncronos y formControl setValue o patchValue. Empieza rastreando la propagación de valores de mat-selection-list y mat-list-option; se considera terminado cuando las casillas de verificación reflejan el array de strings actualizado después de actualizar el formulario.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100