JumpLink / angular-toggle-switch

AngularJS Toggle Switch
http://jumplink.github.io/angular-toggle-switch/
MIT License
68 stars 37 forks source link

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

Closed hellowin closed 9 years ago

hellowin commented 9 years ago

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.

JumpLink commented 9 years ago

fixed

hellowin commented 9 years ago

@JumpLink thank you.

h6784rfg6 commented 8 years ago

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?

lfallo1 commented 8 years ago

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