changeset 913:18133605e4ce

fix angular api Ignore-this: b3a3275dec9c6df4770533ab5b865c17 darcs-hash:20130901074604-312f9-87eada22d8fb0530d88856d2fa8c7de0ee8a7151
author drewp <drewp@bigasterisk.com>
date Sun, 01 Sep 2013 00:46:04 -0700
parents 61395ae2c9ef
children bd71328af896
files service/laundry/static/gui.js
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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();
         });
     }