-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from ffan-fe/dev
small fix
- Loading branch information
Showing
8 changed files
with
46 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,12 @@ | ||
import dateModelFormat from './dateModelFormat.js' | ||
import dateViewFormat from './dateViewFormat.js' | ||
import BpFieldError from './bpFieldError.js' | ||
import BpLargeThan from './bpLargeThan.js' | ||
import fEnter from './f-enter.js' | ||
import fBindHtml from './f-bind-html.js' | ||
|
||
let bpDirectives = angular.module('bp.directives', []) | ||
.directive('dateModelFormat', ()=>dateModelFormat) | ||
.directive('dateViewFormat', ()=>dateViewFormat) | ||
.directive('bpFieldError', ($compile) => { | ||
'ngInject' | ||
return new BpFieldError($compile); | ||
}) | ||
.directive('bpLargeThan', () => new BpLargeThan()) | ||
.directive('fEnter', () => fEnter) | ||
.directive('fBindHtml', () => fBindHtml) | ||
.filter('error', function (Errors) { | ||
return function (name, customMessages) { | ||
if (customMessages) { | ||
customMessages = JSON.parse(customMessages); | ||
} | ||
|
||
let errors = angular.extend({}, Errors, customMessages); | ||
console.info('extended errors', errors); | ||
|
||
return errors[name] || name; | ||
}; | ||
}) | ||
.constant('Errors', { | ||
email: '不是有效格式的邮件地址', | ||
url: '不是有效格式的url', | ||
required: '此项不能为空', | ||
same: '此项必须与密码相同', | ||
max: '超过上限', | ||
min: '低于下限', | ||
number: '必须为数字', | ||
parse: '根据验证规则,已重置无效值' | ||
}); | ||
|
||
export default bpDirectives; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.