Angular Custom form validation question

there are floor area and rented area in the form
how to verify that the rented area must be less than or equal to the floor area

Xiaobai asks for advice

  add = this.form.group({
    buildingId: [null, [Validators.required]],
    roomNo: [null, [Validators.required]],
    roomResourceType: ["1"],
    roomBuildAcreage: [null, [Validators.required]],
    roomEquipments: [null],
    roomDecorateState: ["1"],
    roomRentedAcreage: [null, [Validators.required, this.validateRentedAcreage,rentedAcreageValidator(add)]],
    roomResourceState: ["1", [Validators.required]],
    isCharge: ["1", [Validators.required]],
    heatingCost: [null, [Validators.required]],
    roomDesc: [null],
  });
Jan.11,2022

give me a rough idea:


roomBuildAcreageroomRentedAcreage<br>

 this.form.get('roomBuildAcreage').valueChanges
      .subscribe((acreage: number) => {
           this.form.get('roomRentedAcreage').setValidators(Validators.max(acreage))
      })

the interface is based on the invalid prompt of control

Menu