-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Using:
bootstrap-switch: v3.0.2
angular-bootstrap-switch: v0.4.0-alpha.1 - 2014-11-21
angularjs: 1.3.6
If the switch is within a tab that isn't initially visible, then it will not be initialized properly with the value of its ng-model. This is also true with other components that contain/hide the switch like angular-wizard, angular-material tabs (md-tab), etc.
The scope.$watch(attrs.ngModel, function (newValue) { is called properly and sets the state on the element. Later when the element becomes visible, the value is correct but the display state is not.
We're currently working around the issue by setting up an interval which polls to see when the element becomes visible and then makes the call to:
element.bootstrapSwitch('state', newValue === getTrueValue(), true);
This seems to set both the value and display state properly so that they stay in sync, There is likely a better solution.
This does not appear to be covered by an existing test since I was able to clone the project and run the Karma tests with AngularJS 1.3.6. They all passed.