define(['dashboard/dashboard'], function (dashboard) { dashboard.controller('DashboardConfirmDetails', ['$scope', '$state', '$http', function ($scope, $state, $http) { $scope.ConfirmationLoader = false; $scope.ConfirmPolicyInformation = function () { $scope.ConfirmationLoader = true; var url = 'DashboardConfirmDetails/ConfirmRiskItems'; if ($scope.ConfirmType && $scope.ConfirmType != '') { url += '?confirmType=' + $scope.ConfirmType; } $scope.DashboardPost(url) .then(function (success) { console.log(success); switch ($scope.ConfirmType) { case 'DRIVEAPP': $scope.goToState("dashboard.driveapp.overview"); break; case 'ALWAYSON': $scope.goToState("dashboard.alwayson.redeem"); break; default: $scope.goToState("dashboard.home"); } }, function (failure) { $scope.ConfirmationLoader = false; console.log(failure) }); } $scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams, error) { $scope.ConfirmType = toState.parent.split('.')[1].toUpperCase(); }); }]); });