ng2-select2
ng2-select2 copied to clipboard
Changing value dynamically only works first time
This problem can be reproduced in ng2-select2-demo (4. Demo with a value changing): https://nejczdovc.github.io/ng2-select2-demo/
- Click "Change value". Result: Selected value in select 2: car2
- Select car1. Result: Selected value in select 2: car1
- Click "Change value" again. Result: Selected value in select 2: car1 Expected: Selected value in select 2: car2
I met the problem too. I thing it's a bug. Is the anyway to fix the problem??
I thought the answer could be that the function which the button uses allways set the startValue to 'car2' as you can see here.
However, the solution to this I think it would be
public changeValue() { this.startValue = this.exampleData[Math.floor(Math.random() * this.exampleData.length)].id; }
but it does not work either.