1

Angular custom validations for item (dx-item) how can I get reference to this in devextreme and 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;
  }
Tomislav Stankovic
  • 3,080
  • 17
  • 35
  • 42
Tom Brzeski
  • 501
  • 1
  • 5
  • 9

1 Answers1

3

Ok, finally I found the correct answer. You need to override it in the constructor;

this.hasDateSet = this.hasDateSet.bind(this);
Tom Brzeski
  • 501
  • 1
  • 5
  • 9