diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2015-12-16 17:15:43 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2015-12-16 17:15:43 +0100 |
commit | 475508baa9f0b21087eb85048d51af342aa09692 (patch) | |
tree | f3e944401efc59c68110f54fcea7f569e928a42f /afb-client/app/Frontend/pages/Sample/SampleModule.js | |
parent | f7e443f996dceb928a047d06e45f59579f1fbc0e (diff) |
Add the app!!!
Diffstat (limited to 'afb-client/app/Frontend/pages/Sample/SampleModule.js')
-rw-r--r-- | afb-client/app/Frontend/pages/Sample/SampleModule.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/afb-client/app/Frontend/pages/Sample/SampleModule.js b/afb-client/app/Frontend/pages/Sample/SampleModule.js new file mode 100644 index 0000000..2a2e777 --- /dev/null +++ b/afb-client/app/Frontend/pages/Sample/SampleModule.js @@ -0,0 +1,48 @@ +(function() { +'use strict'; + +// list all rependencies within the page + controler if needed +angular.module('SampleModule', ['SubmitButton','UploadFile']) + + .controller('SampleController', function ($http) { + var self = this; // I hate JavaScript + this.status='muted-off'; + + console.log ("sample controller"); + + this.MuteOn = function() { + console.log ("Muted"); + // send AJAX request to server + var handler = $http.post('/api/dbus/ping', {type:'mute', action: "on"}); + + handler.success(function(response, errcode, headers, config) { + self.status = 'muted-on'; + }); + + handler.error(function(status, errcode, headers) { + console.log ("Oops /api/dbus/pring err=" + errcode); + self.status = 'muted-error'; + }); + }; + + this.MuteOff = function() { + console.log ("UnMuted"); + // send AJAX request to server + var handler = $http.post('/api/dbus/ping', {type:'mute', action: "off"}); + + handler.success(function(response, errcode, headers, config) { + self.status = 'muted-off'; + }); + + handler.error(function(status, errcode, headers) { + console.log ("Oops /api/dbus/ping err=" + errcode); + self.status = 'muted-error'; + }); + + }; + + + }); + +console.log ("SampleControler Loaded"); +})();
\ No newline at end of file |