Open dejan7 opened 8 years ago
Two things in this pull request:
ui-switch-true-value
ui-switch-false-value
scope.$watch(function () { return ngModel.$modelValue; }, function(newValue,oldValue) { initializeSwitch() });
in link function. And then at the bottom again you had initializeSwitch(); one more time. This caused init function to be called every time switchery is toggled from the interface. Which caused
initializeSwitch();
element.addEventListener('change',function(evt) { scope.$apply(function() { ngModel.$setViewValue(element.checked); })
To be added every time switchery is toggled. So you'd end up calling ngModel.$setViewValue dozens of times on every change for a single instance.
Two things in this pull request:
ui-switch-true-value
andui-switch-false-value
attrs, see readme for description, i've updated it.in link function. And then at the bottom again you had
initializeSwitch();
one more time. This caused init function to be called every time switchery is toggled from the interface. Which causedTo be added every time switchery is toggled. So you'd end up calling ngModel.$setViewValue dozens of times on every change for a single instance.