Closed FSDevelop closed 7 years ago
@aramonc can you merge this in?
Now that it is in, I'm actually experiencing a worse issue, where clicking the switch toggles it between "true, false, false" instead of "true, false".
Perhaps @aramonc 's code was correct the first time with just false
instead of ngModel.$viewValue
Honestly, I don't remember why we did it this way initially. Kind of why I didn't want to add a v1 branch until we had some testing :smile:
Haha well I just did the testing, and verified that @FSDevelop 's code does not work unfortunately. I would rollback the change. I was experiencing the same issue that @FSDevelop was having where the switch was not initializing with my ng-model
value. After re-installing ng-switchery and updating switchery, it somehow solved the issue and now is initializing the switches with the correct ng-model
values
Well, it was an 'open issue' when I initially did it. It was fixing the issue, but maybe it's currently fixed by another commit.
Maybe we could declare a variable:
var pos = ngModel.$viewValue || false;
switchery.setPosition(pos);
So in case there is no ng-model value, we set it to false by default. Or:
switchery.setPosition(ngModel.$viewValue || false);