angular.module("app", ['ui.bootstrap'])

.controller('appController', function($scope, $http, $document){
  $scope.state = "Start"
  $scope.payload = {
    category: "",
    timestamp: "",
    state: ""
  }


  $scope.sendData = function($event, $document){
    var target = document.getElementById('category').innerHTML
    $scope.payload.category = target;
    $scope.payload.timestamp = Date.now();
    $scope.payload.state = $scope.state
    $http.post('/api/toggleActivity', JSON.stringify($scope.payload))
  }

// testing stuff
  $scope.changeState = function(){
    $scope.state === "Start" ? $scope.state = "Stop" : $scope.state = "Start"
  }


  //
  //
  // $scope.recieveData = function(){
  //
  // }
})

@@ -201,16 +201,133 @@
 %22%22%0A  %7D%0A%0A
+  $scope.changeState = function()%7B%0A    $scope.state === %22Start%22 ? $scope.state = %22Stop%22 : $scope.state = %22Start%22%0A  %7D%0A
 %0A  $scop
@@ -631,158 +631,10 @@
  %7D%0A%0A
-// testing stuff%0A  $scope.changeState = function()%7B%0A    $scope.state === %22Start%22 ? $scope.state = %22Stop%22 : $scope.state = %22Start%22%0A  %7D%0A%0A%0A  //%0A  //%0A  //
+%0A 
  $sc
@@ -667,17 +667,10 @@
 ()%7B%0A
+%0A
  
- //%0A  //
  %7D%0A%7D

revert test