Home > Software design >  Angular input disabled
Angular input disabled

Time:01-20

https://stackblitz.com/edit/angular-knhkqu-grpmd5?file=src/app/input-overview-example.html,src/app/input-overview-example.ts

    <form >
  <mat-form-field >
    <mat-label></mat-label>
    <input matInput placeholder="Ex. Pizza" [disabled]="filterValue" />

    <mat-label *ngIf="filterValue">Search</mat-label>
    <mat-label *ngIf="!filterValue"> No Search</mat-label>
  </mat-form-field>
  <button mat-raised-button (click)="filter()">Basic</button>
</form>

     
    
      filterValue: boolean = false;
      filter() {
        this.filterValue = !this.filterValue;
      }

Main problem in my app is now that IF user will write something to searbbox filter is working but If I click button input is disabled (this is okey) and input is empty (this is okey) but If user will click second time button for enable I want see date before [disabled] input How save value in such case?

CodePudding user response:

Your example has a typo in line 9:

<button mat-raised-button (ckick)="filter()">Basic</button>

Try (click) and not (ckick)

<button mat-raised-button (click)="filter()">Basic</button>

CodePudding user response:

sorry, i should have added this as a comment but i don't have comment privilege yet.

I am finding it a bit difficult to understand your challenge. i just tested your app and your clicks seems to be working fine and doing what's expected base on your .ts file, but what do you mean by

I want see date before...

is that suppose to be DATE or a typo? you don't have any date variable in your app.

  • Related