|
angular.module('avalanche3mobile.MissionCtrl', [])
.controller('MissionCtrl', function($scope, $rootScope, $location, $ionicModal, $timeout, missionData, $ionicSideMenuDelegate, $cordovaStatusbar, $state, DataService, OAuthService, $localstorage) {
// With the new view caching in Ionic, Controllers are only called
// when they are recreated or on app start, instead of every page change.
// To listen for when this page is active (for example, to refresh data),
// listen for the $ionicView.enter event:
//$scope.$on('$ionicView.enter', function(e) {
//});
$scope.currentMissions = $localstorage.getObject('missions');
console.log("> Current Mission: " + $state.params.missionId)
$scope.mission = DataService.getMission($state.params.missionId);
$rootScope.$on('$stateChangeSuccess',
function(event, toState, toParams, fromState, fromParams){
$scope.mission = DataService.getMission($state.params.missionId);
});
$scope.isActive = function (viewLocation) {
//console.log(viewLocation + " | " + $location.path())
if($state.params.missionId == viewLocation) { return true; }
else { return false; }
};
$scope.toggleLeft = function() {
//console.log("Opening left menu")
$ionicSideMenuDelegate.toggleLeft();
// if($cordovaStatusbar.isVisible()){
// //$cordovaStatusbar.hide();
// } else {
// //$cordovaStatusbar.show();
// }
};
})
|