我试图将ember-cp-validations集成到我的项目中,到目前为止,代码运行k但是当我尝试运行"验证"方法我收到此错误
未捕获的TypeError:Validator.getDependentsFor不是函数
我将错误追踪到此行
https://github.com/offirgolan/ember-cp-validations/blob/v2.9.3/addon/validations/factory.js#L436
const dependents = Validator.getDependentsFor(attribute, options) || [];
尝试在此处返回的Validator对象上调用函数getDependentsFor
https://github.com/offirgolan/ember-cp-validations/blob/v2.9.3/addon/validations/factory.js#L434
const Validator = type === 'function' ? BaseValidator : lookupValidator(owner, type);
因为类型等于"存在"它使用lookupValidator
查找验证器并找到它,但返回的类没有函数getDependentsFor
,我不确定这是一个错误还是我'我遗漏了一些东西:/
版本 恩伯:2.5.1 Ember数据:2.6.1 ember-cp-validations:2.9.3
import { validator, buildValidations } from 'ember-cp-validations';
const Validations = buildValidations({
email: [
validator('presence', true),
validator('format', { type: 'email', allowBlank: true })
]
});
var User;
User = DS.Model.extend(Validations, {
...
})
任何帮助将不胜感激!
提前致谢!!!