SHARE
TWEET

Untitled

a guest Jan 16th, 2016 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var StatsController = function($scope, $state, $ionicPopup, $ionicHistory, $stateParams) {
  2.  
  3.     $scope.stats = {}; //Form model
  4.  
  5.     var Stats = Parse.Object.extend("Stats");
  6.     var timestamp = Number($stateParams.date);
  7.     var id = null;
  8.  
  9.     var query = new Parse.Query(Stats);
  10.     query.equalTo("timestamp", timestamp);
  11.     query.find().then(function(results) {
  12.  
  13.         if (results.length > 0) {
  14.             id = results.id;
  15.             $scope.stats.water = results[0].attributes.water;
  16.             $scope.stats.soda = results[0].attributes.soda;
  17.             $scope.stats.coding = results[0].attributes.coding;
  18.             $scope.stats.tv = results[0].attributes.tv;
  19.             $scope.stats.bed = results[0].attributes.bed;
  20.             $scope.stats.wake = results[0].attributes.wake;
  21.             $scope.stats.waste = results[0].attributes.waste;
  22.             $scope.stats.mood = results[0].attributes.mood;
  23.             $state.$apply;
  24.         }
  25.  
  26.     });
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top