1

item () 的 Angular 自定义验证dx-item如何在 devextreme 和 Angular 4 中获得对此的引用?

<dxi-validation-rule type="custom" [validationCallback]="hasDateSet" message="Follow up date is required."></dxi-validation-rule>

    <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;
  }
4

1 回答 1

3

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

this.hasDateSet = this.hasDateSet.bind(this);
于 2018-02-06T15:39:55.233 回答