0
<div formArrayName="addGrp">
    <div id="ifElse_block" class="create-rules-section" *ngFor="let grp of addGrp().controls; let k=index" [formGroupName]="k">
        <div formGroupName="ifBlockRule" class="ifBlockRule">
             <!-- how disable below button after one click in each array element-->
             <button mat-raised-button color="primary" type="button" class="addGrpCond" (click)="ifBlockAddGrpCondition(k)" [disabled]="addGrpBtnclicked" title="Add group condition">
             <mat-icon>add</mat-icon>
             </button>
             <!-- how disable above button after one click in each array element-->
        </div>
    </div>
</div>

How to disable the button mentioned in commented lines after one click in array element? I am new to angular.

3
  • Can you also share the typescript part of your code? Commented Jul 13, 2021 at 11:30
  • I cant share whole code but : Commented Jul 13, 2021 at 17:12
  • rule_object: this.fb.group({ addGrp: this.fb.array([]),}) addGrp(): FormArray {return this.createRuleForm.get("rule_object.addGrp") as FormArray;} newGrp(): FormGroup { return this.fb.group({ ifBlockRule: ''}) } addGrpElements() {this.addGrp().push(this.newGrp());} removeGrp(k: number) {this.addGrp().removeAt(k);} ifBlockAddGrpCondition(k: number) {need something here} Commented Jul 13, 2021 at 17:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.