Skip to content Skip to sidebar Skip to footer

How To Change The Properties Of A Button

I have a button as My Template,
[disabled]="isDisabled">{{req}} {{innerHTML}}</button>

in Component,

{
 isDisabled:boolean:false;
 innerHTML:string='';

this._service.getList().subscribe((response) => {
      this.details = response;
      this.details.forEach((detail)=>{   //<----you are iterating through each object of this.details list.

      if(detail.approved == null){       //<----please note that I changed each if condition with respect to forEach

        //button.innerHTML = "Add frnd";
        //button.disabled = true; 

        this.innerHTML="Add frnd";
        this.isDisabled=true;
      }
      if(detail.approved == 1){
         //button.disabled = true;

          this.isDisabled=true;

     }
      if(detail.status == 1){
          //button.innerHTML = "Pending";

          this.innerHTML="pending";
      }

      });
  }

}


Post a Comment for "How To Change The Properties Of A Button"