Alberplz / angular2-color-picker

Angular 2 Color Picker Directive, no dependences required.
MIT License
185 stars 82 forks source link

The colorpicker not re-initilize color. #45

Closed PoppyPham closed 7 years ago

PoppyPham commented 7 years ago

I have two input like this:

            <div class = "form-group">
                <label for="editbox-bgcolor"> Background color </label>
                <input class = "colorpicker" [cpCancelButton] = "true" name = "editbox-bgcolor" [(colorPicker)]="selectedBox.bgColor" [style.background]="selectedBox.bgColor" [value] = "selectedBox.bgColor"/>
            </div>

When first time I opened color picker, all thing was fine. I move cursor and chose other value, then I closed the picker. Then "selectedBox.bgColor" was updated. It updated due to the change of my model (I chose another box which have other bgColor). Then In this time the [style.background] and [value] was updated correctly. But when I open the color picker panel, the initialized cursor still pointed to the last value that i set to the last box before, it was not update to my new "selectedBox.bgColor" when i opened it.

How can I reinit this value cursor when my model change?

Thanks!!

Alberplz commented 7 years ago

Hi, In the next version when you change your model outside the cursor updates too

PoppyPham commented 7 years ago

Great! Thanks alot @Alberplz.