Working with ng-model and input-type=range


I guess this is more of a angular problem than ionic.
Here’s a codepen trying to explain the problem I’m facing :

No matter what number I select, my model doesn’t seem to get updated.
This issue has already been raised on Angular’s github : &

Let me know if anyone knows a temporary hack for this.


You need to use dot notation. When you just use “numberSelection”, you do not get 2 way binding. You get simple inheritance.

Here is a working example.

Issue with model binding when using ionic

@Calendee Thanks. Could you just elaborate a little on why did you define the model as data.numberSelection? And should I always define models like this?


It all comes down to prototypal inheritance. This is the definitive resource on the subject :

Short Answer : Yes, mostly, almost always


problem with dot notation is it doesn’t initialize :frowning: what is a workaround for this