如何允许用户单击标题部分中的下一个按钮?

时间:2019-07-16 09:58:06

标签: javascript angular

我有一个按钮列表,可以从中导航到其他页面并显示

创建变量

currentStep :number=1;

根据按钮为当前步骤添加ng-disable。

<button class="btn btn-outline-primary" (click)="first()" ng-disabled="currentStep == 1">First</button>
<button class="btn btn-outline-secondary" (click)="second()" ng-disabled="currentStep == 2">Second</button>
<button class="btn btn-outline-danger" (click)="third()" ng-disabled="currentStep == 3">Third</button>
<button class="btn btn-outline-warning" (click)="fourth()" ng-disabled="currentStep == 4">Fourth</button>
<button class="btn btn-outline-dark" (click)="fifth()" ng-disabled="currentStep == 5">Fifth</button>

不会填充数据并允许禁用的按钮传递第二页

1 个答案:

答案 0 :(得分:1)

创建变量

currentStep :number=1;

根据按钮为当前步骤添加ng-disable。

<button class="btn btn-outline-primary" (click)="first()" ng-disabled="currentStep == 1">First</button>
<button class="btn btn-outline-secondary" (click)="second()" ng-disabled="currentStep == 2">Second</button>
<button class="btn btn-outline-danger" (click)="third()" ng-disabled="currentStep == 3">Third</button>
<button class="btn btn-outline-warning" (click)="fourth()" ng-disabled="currentStep == 4">Fourth</button>
<button class="btn btn-outline-dark" (click)="fifth()" ng-disabled="currentStep == 5">Fifth</button>