Using parent information with Aurelia Validation


Hello all,

I’m not sure if this question has already been handled in this blog but I couldn’t find anything. Currently my problem is the following:

I have two models, a parent and a child:

export class parent{
    public property: boolean;
    public childs : Child[];
export class child{
    public childProperty: boolean;

Now I want to add a validation rule to childProperty that it has to be true if the parent property is false. How can I handle that?

    .ensure((c : Child) : c.childProperty)
          ///IF PARENT "PROPERTY " is false && childProperty == true) return false ??

I know I could validate the “childProperty” starting on parent, but the aim is that the “childProperty” input field is marked red if this rule is not valid.