blur-admin icon indicating copy to clipboard operation
blur-admin copied to clipboard

Switch Bootstrap

Open vitalibr opened this issue 8 years ago • 3 comments

The directive Switch creates the bootstrap switch once the page is loaded.

But if you try to change the switch ngModel after loading the DOM, the button state (on or off) is not changed. (E.g. Loading server data).

It is necessary to load the plugin again? like this:

var input = $(elem).find('input');
input.bootstrapSwitch({
    size: 'small',
    onColor: attr.color
});

vitalibr avatar Oct 11 '16 00:10 vitalibr

I was struggling with the same issue. The solution was simple: do not use this directive. Instead use: https://github.com/JumpLink/angular-toggle-switch (especially check out it's is-disabled atribute, which will work when ngModel has changed. Alternative solution does not have this feature: https://github.com/frapontillo/angular-bootstrap-switch/issues/96)

majkelo avatar Oct 23 '16 23:10 majkelo

nice @majkelo !

Look my PR :) simple and solved the issue

https://github.com/akveo/blur-admin/pull/187/commits/1c8bb71c55d227fb92428a90d3c6119e8a7f39b1

vitalibr avatar Oct 24 '16 00:10 vitalibr

@vitalibr nice, I have already used it(your pr),and solved the problem

ThoughtZer avatar Mar 26 '18 03:03 ThoughtZer