cgarvis / angular-toggle-switch

AngularJS Toggle Switch
http://cgarvis.github.io/angular-toggle-switch
MIT License
160 stars 124 forks source link

on true or false value #57

Closed wesley3523 closed 9 years ago

wesley3523 commented 9 years ago

Is it possible to get other value than true or false? for example
[ng-true-value=""] [ng-false-value=""]

cstephe commented 9 years ago

quick example of how angular-material is doing this: https://material.angularjs.org/#/api/material.components.switch/directive/mdSwitch

cgarvis commented 9 years ago

Set a watch on your model and make set the values in your controller.

$scope.watch('switchModel', function(val) {
  if(val) {
    $scope.otherValue = 'a';
  } else {
    $scope.othervalue = 'b';
  }
})