Validation 如何使breezejs必需的验证器允许空字符串
breezejs中允许在所需属性中使用空字符串的首选方式是什么 我发现建议如下更换所需的验证器:Validation 如何使breezejs必需的验证器允许空字符串,validation,breeze,Validation,Breeze,breezejs中允许在所需属性中使用空字符串的首选方式是什么 我发现建议如下更换所需的验证器: Validator.required = function (context) { var valFn = function (v, ctx) { return v != null; } return new Validator("required", valFn, context); }; // register the new validator so t
Validator.required = function (context) {
var valFn = function (v, ctx) {
return v != null;
}
return new Validator("required", valFn, context);
};
// register the new validator so that metadata can find it.
Validator.registerFactory(Validator.required, "required");
在某个地方还提到了allowEmptyStrings
标志
执行此操作的首选方法是什么?您可以创建一个“必需”验证器,该验证器允许以下空字符串:
var v0 = Validator.required({ allowEmptyStrings: true });
替换所需验证器工厂的原始技术仍然是全局允许空字符串的首选方法吗?@JayTraband:很高兴能对此进行更新。@JeremyDanyow您是如何全局实现的?