具有范围参考的Devextreme自定义验证器

时间:2018-02-06 14:44:55

标签: devextreme-angular

项目(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;

}

1 个答案:

答案 0 :(得分:2)

好的,最后我找到了正确的答案。您需要在构造函数中覆盖它;

this.hasDateSet = this.hasDateSet.bind(this);