Skip to content

Instantly share code, notes, and snippets.

@kis
Created September 9, 2015 12:57
Show Gist options
  • Save kis/36d4ea9021b6c8e57bc3 to your computer and use it in GitHub Desktop.
Save kis/36d4ea9021b6c8e57bc3 to your computer and use it in GitHub Desktop.
run block
(function() {
'use strict';
angular
.module('uaMain')
.run(runBlock);
/** @ngInject */
function runBlock($rootScope, $log, $state, bootstrap3ElementModifier, defaultErrorMessageResolver, validator, editableOptions) {
// Set $state visible for all scopes
$rootScope.$state = $state;
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
throw error;
});
// bootstrap3 theme for x-editable. Can be also 'bs2', 'default'
editableOptions.theme = 'bs3';
//Enable bootstrap 3 autovalidate icons states
bootstrap3ElementModifier.enableValidationStateIcons(false);
validator.setValidElementStyling(false);
// Configure forms default error messages
defaultErrorMessageResolver.getErrorMessages().then(function(errorMessages) {
errorMessages = {
"emailValidity": 'This email already registered.',
"emailDomainValidity": 'Invalid Email. Please verify it. Valid domain zones for Email are: .com, .net, .edu, .org, .gov, .us, .biz, .info, .mil, .ca, .cc',
"usernameValidity": 'This username is already taken.',
"onlyNumbers": 'Only numbers is allowed.',
"phoneMask": 'This phone number do not match the mask.',
"passwordMatch": 'Password do not match!',
"zip": 'Invalid ZIP format.',
"captchaValidity": 'Incorrect Security Code!',
"club_code": 'Incorrect club Code!',
"region_code": 'Incorrect region Code!',
"securityCode": 'Security code do not match!'
};
});
$log.debug('runBlock end');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment