// Controller of dashboard. appControllers.controller('dashboardCtrl', function ($scope, $timeout, $state,$stateParams, $ionicHistory) { //$scope.isAnimated is the variable that use for receive object data from state params. //For enable/disable row animation. $scope.isAnimated = $stateParams.isAnimated; // navigateTo is for navigate to other page // by using targetPage to be the destination state. // Parameter : // stateNames = target state to go. $scope.navigateTo = function (stateName) { $timeout(function () { if ($ionicHistory.currentStateName() != stateName) { $ionicHistory.nextViewOptions({ disableAnimate: false, disableBack: true }); $state.go(stateName); } }, ($scope.isAnimated ? 300 : 0)); }; // End of navigateTo. // goToSetting is for navigate to Dashboard Setting page $scope.goToSetting = function () { $state.go("app.dashboardSetting"); };// End goToSetting. }); // End of dashboard controller. // Controller of Dashboard Setting. appControllers.controller('dashboardSettingCtrl', function ($scope, $state,$ionicHistory,$ionicViewSwitcher) { // navigateTo is for navigate to other page // by using targetPage to be the destination state. // Parameter : // stateNames = target state to go. // objectData = Object data will send to destination state. $scope.navigateTo = function (stateName,objectData) { if ($ionicHistory.currentStateName() != stateName) { $ionicHistory.nextViewOptions({ disableAnimate: false, disableBack: true }); //Next view animate will display in back direction $ionicViewSwitcher.nextDirection('back'); $state.go(stateName, { isAnimated: objectData, }); } }; // End of navigateTo. }); // End of Dashboard Setting controller.