Skip to content

bugfix and new attributes#37

Open
dejan7 wants to merge 2 commits intoservergrove:masterfrom
dejan7:master
Open

bugfix and new attributes#37
dejan7 wants to merge 2 commits intoservergrove:masterfrom
dejan7:master

Conversation

@dejan7
Copy link
Copy Markdown

@dejan7 dejan7 commented Aug 14, 2016

Two things in this pull request:

  1. I've added ui-switch-true-value and ui-switch-false-value attrs, see readme for description, i've updated it.
  2. You had
    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

              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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant