ng2-nouislider icon indicating copy to clipboard operation
ng2-nouislider copied to clipboard

Formatter does not work together with ngModel

Open bjolletz opened this issue 6 years ago • 0 comments

Hi!

Thanks for providing this component!

I have a problem with using a formatter together with ngModel. As far as I understand, when using a formatter you are supposed to provide 'formatted' values for ngModel. Because if I don't, then the sliders will not begin at the correct positions. However, when changing the sliders, 'unformatted' values are assigned back to the ngModel property.

For instance, if I begin with something like

model = ['#1', '#2']; // Formatted values

[(ngModel)]="model",
[format]="someFormatter"

...and provide a formatter that maps back and forth between numbers and strings, then after dragging the slider, the value of the model property will be an (unformatted) array of numbers instead of the expected array of (formatted) strings.

This might be related to #50 . Is this something you're aware of? I could probably provide an example project, but will not bother if you're already aware of this issue.

bjolletz avatar Aug 31 '18 15:08 bjolletz