diff --git a/angular-ui-switch.js b/angular-ui-switch.js index 9a6b591..80e82e3 100644 --- a/angular-ui-switch.js +++ b/angular-ui-switch.js @@ -9,8 +9,8 @@ angular.module('uiSwitch', []) var html = ''; html += ''+e.on+"":"",s+=e.off?''+e.off+"":" ",s+=""}}}); \ No newline at end of file +angular.module("uiSwitch",[]).directive("switch",function(){return{restrict:"AE",replace:!0,transclude:!0,template:function(n,e){var s="";return s+="'+e.on+"":"",s+=e.off?''+e.off+"":" ",s+=""}}}); diff --git a/example/app.js b/example/app.js index 3d12135..18ea133 100644 --- a/example/app.js +++ b/example/app.js @@ -1,11 +1,15 @@ angular.module('app', ['uiSwitch']) -.controller('MyController', function($scope) { +.controller('MyController', function($scope, $timeout) { $scope.enabled = true; $scope.onOff = true; $scope.yesNo = true; $scope.disabled = true; - + + $scope.dynamicDisabled = true; + $timeout(function() { + $scope.dynamicDisabled = false; + }, 1000); $scope.changeCallback = function() { console.log('This is the state of my model ' + $scope.enabled); diff --git a/example/index.html b/example/index.html index 6adb029..6572de8 100644 --- a/example/index.html +++ b/example/index.html @@ -1,4 +1,4 @@ - + @@ -43,9 +43,28 @@

+

+ Enabled: {{ disabled }} +

+ + +

- Enabled: {{ disabled }} +

+

+ Enabled: {{ disabled }} +

+ +

Using invert - which shows the switch in the opposite arrangement

+ + +

+ +

+

+ Enabled: {{ inverted }} +