我想在表单显示最后一条记录时禁用下一个按钮,而在表单显示第一条记录时禁用上一个按钮

时间:2019-01-02 05:49:25

标签: html typescript

mortgage_items: GetMtgMortgageMasterForView[];  
  CurrentRecordIndex: number;
  
  	onClicknext(): void {
		if (this.CurrentRecordIndex < this.mortgage_items.length - 1)
		{
			//increment only if current index is less than length - 1
			this.CurrentRecordIndex = this.CurrentRecordIndex + 1;
			this.showData();
			
		}

	  }

	  onClickprevious(): void{
		if (this.CurrentRecordIndex >0)
		{
			//decrement only if current index is more than 0
			this.CurrentRecordIndex = this.CurrentRecordIndex - 1;
			this.showData();			
		}

	  }
 <div class="form-group m-form__group row">
              <div class="col-lg-4">
                <label for="colFormLabelSm" class=" col-form-label col-form-label-sm">Customer Zip</label>
              </div>
              <div class="col-lg-7">
                <input type="text" id="customerZipFilter" class="form-control form-control-sm" [(ngModel)]="customerZipFilter" [ngModelOptions]="{standalone: true}">
              </div>
            </div>
            <div class="form-group m-form__group row">
              <div class="col-lg-4">
                <label for="colFormLabelSm" class=" col-form-label col-form-label-sm">Expiration Date</label>
              </div>
              <div class="col-lg-7">
                <input type="text" id="maxExpirationDateFilter" class="form-control form-control-sm" [(ngModel)]="maxExpirationDateFilter" [ngModelOptions]="{standalone: true}" >
              </div>
            </div>
            
 <button class="btn btn-primary blue" (click)="onClickprevious()"><i class="fa fa-chevron-left"></i>Previous</button>
    <button class="btn btn-danger red" [disabled]="statusId == 3 || statusId == 4 " (click)="onClickreject()"><i class="fa fa-times"></i>Reject</button>
    <button class="btn btn-info metal" [disabled]="statusId == 3 || statusId == 4 " (click)="onClicksave()"><i class="fa fa-save"></i> Save </button>
    <button class="btn btn-success green" [disabled]="statusId == 3 || statusId == 4 " (click)="onClicksubmit()"> <i class="fa fa-check"></i>Submit</button>
    <button class="btn btn-primary blue"(click)="onClicknext()"><i class="fa fa-chevron-right"></i>Next</button>

我在数据库中有记录,并且字段上也显示了数据,并且下一个和上一个按钮用于一次获取记录。但是我想禁用下一个和上一个按钮以在有第一个和最后一个记录时禁用,并且和我有作为抵押项的数据传输对象,它具有数据库中的所有记录。

0 个答案:

没有答案