app.run(['$rootScope', function ($rootScope) { $rootScope.translateMessage = function (text, data) { switch (text) { case 'PASSWORD_INCORRECT': err = "Password Incorrect"; break; case 'USER_BANNED': err = "User Banned"; break; case 'User is suspended, Please contact administrator.': err = "User is suspended, Please contact administrator."; break; default: err = text; } return err; } }]);