app.controller('ReadyMenuSecondController',['$scope','$location','$timeout',function($scope,$location,$timeout){
  $scope.currentPath = $location.path();

  if($scope.currentPath.indexOf('loss') > -1){
    $scope.filterBy = 'loss';
  } else if($scope.currentPath.indexOf('gain') > -1){
    $scope.filterBy = 'gain';
  } else if($scope.currentPath.indexOf('balance') > -1){
    $scope.filterBy = 'balance';
  }

  var firebaseDiets = firebase.database().ref().child('diets');
  $scope.diets = {};
  firebaseDiets.on('value', snap => {
    $timeout(function(){
      $scope.diets = snap.val();
    })

  })
}])
