【问题标题】:Devextreme custom validator with scope reference具有范围参考的 Devextreme 自定义验证器
【发布时间】:2018-02-06 14:44:54
【问题描述】:

项目 (dx-item) 的 Angular 自定义验证如何在 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;
  }

【问题讨论】:

    标签: devextreme-angular


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多