项目(dx-item)的角度自定义验证如何在devextreme和angular 4中引用它?
<dxi-validation-rule type="custom" [validationCallback]="hasDateSet" message="Follow up date is required."></dxi-validation-rule>
hasDateSet(e): boolean {
//how can I get referece to this (scope)
//this here give me validator => e
console.log(e);
return false;
}
答案 0 :(得分:2)
好的,最后我找到了正确的答案。您需要在构造函数中覆盖它;
this.hasDateSet = this.hasDateSet.bind(this);