# HG changeset patch # User drewp@bigasterisk.com # Date 1378021564 25200 # Node ID 64ad5ad17dc1f9c72b26c25e37f11413c9500642 # Parent 08eb981b6cf5627edcfee09f3816bf865928a64f fix angular api Ignore-this: b3a3275dec9c6df4770533ab5b865c17 diff -r 08eb981b6cf5 -r 64ad5ad17dc1 service/laundry/static/gui.js --- a/service/laundry/static/gui.js Sun Sep 01 00:45:15 2013 -0700 +++ b/service/laundry/static/gui.js Sun Sep 01 00:46:04 2013 -0700 @@ -1,27 +1,27 @@ 'use strict'; -function Ctrl($scope, $http) { - function refresh() { +function Ctrl($scope, $http, $timeout) { + $scope.refresh = function () { $http.get("status").success(function (data) { $scope.status = data; }); } - refresh(); + $scope.refresh(); $scope.setLed = function (value) { - $http.put("led", value).succeed(function () { - refresh(); + $http.put("led", value).success(function () { + $scope.refresh(); }); }; $scope.temporaryUnlock = function () { var seconds = 3; - $http.put("strike/temporaryUnlock", {seconds: seconds}).succeed(function () { - refresh(); - setTimeout(function () { refresh(); }, (seconds + .1) * 1000); + $http.put("strike/temporaryUnlock", {seconds: seconds}).success(function () { + $scope.refresh(); + $timeout($scope.refresh, (seconds + .1) * 1000); }); }; $scope.beep = function () { - $http.put("speaker/beep").succeed(function () { + $http.put("speaker/beep").success(function () { $scope.speakerStatus = "sent at " + new Date(); }); }