本文整理匯總了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);
},