Update switch.directive.js

the switch work failed! you should add listener on input,such as line 28~31.
pull/46/head
luqihang 2016-05-31 23:26:04 +08:00
parent be74da99b5
commit 4f0cf74dda
1 changed files with 8 additions and 2 deletions

View File

@ -20,12 +20,18 @@
link: function (scope, elem, attr) {
$timeout(function(){
scope.color = attr.color;
$(elem).find('input').bootstrapSwitch({
var input = $(elem).find('input');
input.bootstrapSwitch({
size: 'small',
onColor: attr.color
});
input.on('switchChange.bootstrapSwitch', function(event, state) {
scope.ngModel = state;
scope.$apply();
});
});
}
};
}
})();
})();