Hi Rhett,
$watch has a third parameter "objectEquality", setting it to true will
compare the values in the array.
Kind Regards,
Tijs
Op maandag 10 februari 2014 23:25:07 UTC+1 schreef Rhett Lowe:
>
> Ok, I love ngModelController. I find it to be wonderfully helpful and
> surprisingly useful in the long run.
>
> I have been making a ranged slider. I started with `require: 'ngModel'`
> where ngModel was an array of length 2 (i.e. "[0.0, 10.0]"). The slider
> worked perfectly in both directions except one thing, if I changed a value
> in the array the slider wouldn't update. I realize this is because the
> ngModel's $watcher is on the `[]` object and not it's variables.
>
> My current plan is to either:
>
> 1. Change the ngModel Watcher to function(){ return old[0] === new[0]
> && old[1] === new[1] }, or
> 2. have 2 ngModelControllers. (i.e. ngModelLow and ngModelHigh)
>
> Solution 1 didn't pan out. I cannot find the $watcher code and I don't
> think it is public so I cannot change it publicly (unless you all know
> something I don't)
>
> Solution 2 was working in my head pretty well. I found that if you
> `require: ['ngModelLow', 'ngModelHigh']` you will be able to have 2
> controllers. But they are no longer ngModelControllers they are
> ngModelLowController and ngModelHighController. Since these controllers
> don't exist it throws a $compile error. I don't want to make new
> controllers that approximate ngModelController -- I want ngModelController
>
> 1. Does anyone know if solution 1 above is possible?
> 2. Is there a way to make 2 new ngModelControllers named
> ngModelLowController and ngModelHighController which reference
> ngModelController?
> 3. Is there a wholly better way of doing this?
>
> Thank you all in advance for any incite you might provide.
> -- Rhett Lowe :D
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.