From e2f100a8eea7262e61ee0cbfb82e481083993858 Mon Sep 17 00:00:00 2001 From: tyrion85 Date: Tue, 17 Jan 2017 20:26:39 +0100 Subject: [PATCH] Removed explicit setting of brackets for ngChange attribute. Code should be backward compatibile - for settings without brackets, they should still be inserted automatically. This solves the issue #10 --- angular-ui-switch.js | 2 +- angular-ui-switch.min.js | 2 +- example/app.js | 5 +++++ example/index.html | 11 +++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/angular-ui-switch.js b/angular-ui-switch.js index 9a6b591..8b8d48f 100644 --- a/angular-ui-switch.js +++ b/angular-ui-switch.js @@ -9,7 +9,7 @@ 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(a,b){var c="";return c+="'+b.on+"":"",c+=b.off?''+b.off+"":" ",c+=""}}}); \ No newline at end of file diff --git a/example/app.js b/example/app.js index 3d12135..e915dec 100644 --- a/example/app.js +++ b/example/app.js @@ -2,6 +2,7 @@ angular.module('app', ['uiSwitch']) .controller('MyController', function($scope) { $scope.enabled = true; + $scope.enabledWithArguments = true; $scope.onOff = true; $scope.yesNo = true; $scope.disabled = true; @@ -10,4 +11,8 @@ angular.module('app', ['uiSwitch']) $scope.changeCallback = function() { console.log('This is the state of my model ' + $scope.enabled); }; + + $scope.changeCallbackWithArguments = function(arg) { + console.log('This is the state of my model ' + $scope.enabledWithArguments + '\nValue of passed argument is "' + arg.someArgument + '"' + "\n"); + }; }); diff --git a/example/index.html b/example/index.html index 6adb029..b683697 100644 --- a/example/index.html +++ b/example/index.html @@ -19,6 +19,17 @@

Enabled: {{ enabled }}

+ + + +

+ +

+

+ EnabledWithArguments: {{ enabledWithArguments }} +

+ +