Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

select(multiple): rendering bug when model array is changed #11952

Open
ghost opened this issue Jun 30, 2020 · 2 comments
Open

select(multiple): rendering bug when model array is changed #11952

ghost opened this issue Jun 30, 2020 · 2 comments
Labels
needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue

Comments

@ghost
Copy link

ghost commented Jun 30, 2020

I was trying to solve a general problem with the md-select directive: It is necessary to update the selected value(s) when the array list changes (to avoid remain values that does not exist in this current list).

I achieve it within a directive declaration, but I found an important trouble:

When I change selected value(s), the component is not automatically rendered. What do I need to implement for it?

Here is a testing demo.

@Splaktar Splaktar added needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue needs: more info The issue does not contain enough information for the team to determine if it is a real bug labels Jul 1, 2020
@Splaktar
Copy link
Member

Splaktar commented Jul 1, 2020

I don't fully understand what your custom directive is trying to do. Can you please explain the initial problem that you encountered that let to your need to create that directive? Do you have a demo of what is not working properly w/o that directive?

You may also want to take a look at https://material.angularjs.org/1.1.24/api/directive/mdSelect#selects-and-object-equality, including the part about using ng-model-options="{trackBy: '$value.code'}".

@ghost
Copy link
Author

ghost commented Jul 1, 2020

Let's go to a real example (to understand this)!:

In a multiple md-select, you select several options. After, the array list is replaced by another new one. What is happening? Well, the current selected values is not related with the current list because these was previously defined.

What I am trying to do is avoid this.

@Splaktar Splaktar removed the needs: more info The issue does not contain enough information for the team to determine if it is a real bug label Jul 2, 2020
@Splaktar Splaktar changed the title Rendering bug select(multiple): rendering bug when model array is changed Jul 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue
Projects
None yet
Development

No branches or pull requests

1 participant