JumpLink/angular-toggle-switch

Model not change if toggle-switch nested under "ng-if" element

Closed this issue · 4 comments

I try

<div class="col-md-3" ng-if="true">
  <toggle-switch model="someModel" html="true" class="switch-danger"
                 on-label='<i class="fa fa-trash-o"></i>'
                 off-label='<i class="fa fa-trash"></i>'>
    <toggle-switch>
</div>

And someModel not updated if toggle switched.

fixed

@JumpLink thank you.

Sorry to say, but it does't still work properly: model doesn't get updated

<div class="row row-no-margin padding-bottom-5">    
        <toggle-switch ng-model="disableAdvertising" class="switch-les" html="true" on-label="{{'YES' | translate}}" off-label="{{'NO' | translate}}"></toggle-switch>
        <span>&nbsp;Disable advertising</span>
    </div>
    <div ng-if="!disableAdvertising" class="row row-no-margin padding-bottom-5">    
        <toggle-switch ng-model="defaultContent" class="switch-les" html="true" on-label="{{'YES' | translate}}" off-label="{{'NO' | translate}}"></toggle-switch>
        <span>&nbsp;Use default advertising content</span>
    </div>
    <span ng-if="!defaultContent">123</span>

Are there any angularJS or Bootstrap version restrictions?

Unfortunately, same issue still occurring here as well. Not the end of the world, as ng-show works fine for what I need.