本文整理汇总了TypeScript中@binding/ValidatorProvider.ValidatorProvider类的典型用法代码示例。如果您正苦于以下问题:TypeScript ValidatorProvider类的具体用法?TypeScript ValidatorProvider怎么用?TypeScript ValidatorProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValidatorProvider类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
initValidators: function() {
var attr = this.attr,
message = this.attr.message,
isDefault = message == null
if (isDefault) {
message = 'Invalid value of `' + this.attr.value + '`';
}
for (var key in attr) {
switch (key) {
case 'message':
case 'value':
case 'getter':
case 'silent':
continue;
}
if (key in Validators === false) {
log_error('Unknown Validator:', key, this);
continue;
}
var str = isDefault ? (message + ' Validation: `' + key + '`') : message
var fn = ValidatorProvider.getFnByName(key, attr[key], str);
if (fn != null) {
this.validators.push(fn);
}
}
}
示例2: function
renderEnd: function(elements, model, ctx, container) {
this.provider = BindingProvider.create(model, container, this);
var compos = this.components;
if (compos != null) {
var imax = compos.length,
i = -1, x;
while ( ++i < imax ){
x = compos[i];
if (x.compoName === ':validate') {
this.provider.addValidation(x.validations);
}
}
}
if (this.attr['no-validation'] == null) {
var fn = ValidatorProvider.getFnFromModel(model, this.provider.value);
if (fn != null) {
this.provider.addValidation(fn);
}
}
BindingProvider.bind(this.provider);
},