diff --git a/angular-toggle-switch.min.js b/angular-toggle-switch.min.js index ac5b85f..9ad81fe 100644 --- a/angular-toggle-switch.min.js +++ b/angular-toggle-switch.min.js @@ -1 +1 @@ -angular.module("toggle-switch",["ng"]).directive("toggleSwitch",function(){return{restrict:"EA",replace:!0,scope:{model:"=",disabled:"@",onLabel:"@",offLabel:"@",knobLabel:"@"},template:'
',link:function(scope,element,attrs){attrs.onLabel||(attrs.onLabel="On"),attrs.offLabel||(attrs.offLabel="Off"),attrs.knobLabel||(attrs.knobLabel=" "),attrs.disabled||(attrs.disabled=!1),element.on("click",function(){scope.$apply(scope.toggle)}),scope.toggle=function(){scope.disabled||(scope.model=!scope.model)}}}}); \ No newline at end of file +angular.module("toggle-switch",["ng"]).directive("toggleSwitch",function(){return{restrict:"EA",replace:!0,require:"ngModel",scope:{disabled:"@",onLabel:"@",offLabel:"@",knobLabel:"@"},template:'',link:function(scope,element,attrs,ngModelCtrl){attrs.onLabel||(attrs.onLabel="On"),attrs.offLabel||(attrs.offLabel="Off"),attrs.knobLabel||(attrs.knobLabel=" "),attrs.disabled||(attrs.disabled=!1),element.on("click",function(){scope.$apply(scope.toggle)}),ngModelCtrl.$formatters.push(function(modelValue){return modelValue}),ngModelCtrl.$parsers.push(function(viewValue){return viewValue}),ngModelCtrl.$render=function(){scope.model=ngModelCtrl.$viewValue},scope.toggle=function(){scope.disabled||(scope.model=!scope.model,ngModelCtrl.$setViewValue(scope.model))}}}}); \ No newline at end of file diff --git a/bower.json b/bower.json index 4b4f348..d3a4dbd 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-toggle-switch", - "version": "0.3.2", + "version": "0.3.3", "main": [ "angular-toggle-switch.js", "angular-toggle-switch.css" diff --git a/package.json b/package.json index 955028a..6d33c0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-toggle-switch", - "version": "0.3.2", + "version": "0.3.3", "title": "Angular.JS Toggle Switch", "author": { "name": "Chris Garvis",