client-ui
Version:
Testing implementation of nodeJs Backend, angular frontend, and hopefully in a way that this can be deployed to s3/cloudfront
35 lines (28 loc) • 1.07 kB
JavaScript
'use strict';
angular.module(moduleName).controller('navHeaderController', navHeaderController);
navHeaderController.$inject = ['$scope', 'AuthStateFactory', '$state', 'loan'];
function navHeaderController($scope, AuthStateFactory, $state, loanService) {
$scope.loan = loanService;
$scope.logout = function () {
AuthStateFactory.logout()
.then(function(success) {
$state.go('sign-out');
}, function(error) {
console.log(error);
});
};
$scope.shouldHide = function () {
return AuthStateFactory.isLoggedIn;
};
$scope.showContinueLoan = function() {
if ($state.includes('loanApplication') || $state.includes('sorry')
|| $state.includes('loanDashboard.myDashboard')) {
return false;
}
var currentLoan = loanService.getCurrentLoan();
return currentLoan && currentLoan.statusCode < 500;
};
$scope.goToNextStep = function() {
$state.go(loanService.getNextStep());
};
}