/** * Created by robin on 11/3/15. */ (function () { 'use strict'; angular.module('luticateUtils'). controller('luticateDialogError', ['$scope', 'data', '$state', 'luticateAuthCache', function ($scope, data, $state, luticateAuthCache) { $scope.message = data.message; $scope.showLogin = data.data.Status == 401; $scope.reconnect = function() { $scope.$dismiss(); luticateAuthCache.removeUser(); $state.go('login'); }; }]); angular.module('luticateUtils') .factory('luticateDialogErrorHelper', ['dialogs', function (dialogs) { var luticateDialogErrorHelper = {}; luticateDialogErrorHelper.errorMessage = function(data) { var message = data.Data; message += " (HTTP code: " + data.Status + ")"; /*var status = 'Common.Status.HttpStatus.' + data.status; var statusText = tr(status); if (status != statusText) message += " : " + statusText;*/ return message; }; luticateDialogErrorHelper.errorDialog = function(data) { var message = luticateDialogErrorHelper.errorMessage(data); return dialogs.create('/luticateUtils/dialogerror.html', 'luticateDialogError', {message: message, data: data}, {}); }; return luticateDialogErrorHelper; }]); angular.module("luticateUtils").run(["$templateCache", function($templateCache) { $templateCache.put("/luticateUtils/dialogerror.html", '') }]); })();