# HG changeset patch # User drewp # Date 1378021564 25200 # Node ID 18133605e4cee67451bd836b0fc9fe21dc06076e # Parent 61395ae2c9ef0a45f43df034d55ad8808ee7bf62 fix angular api Ignore-this: b3a3275dec9c6df4770533ab5b865c17 darcs-hash:20130901074604-312f9-87eada22d8fb0530d88856d2fa8c7de0ee8a7151 diff -r 61395ae2c9ef -r 18133605e4ce 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(); }); }