我正在尝试打开神经“步进”步骤,该步骤取决于查询参数。 例如:如果route是/ products / create?step = thirdshoud,请打开第三步
<nb-stepper [selected]="'second'">
<nb-step [stepControl]="firstForm" [label]="first" #first>
first
</nb-step>
<nb-step [label]="second" #second>
second
</nb-step>
<nb-step [label]="third" #third>
third
<ng-template #third>Third step</ng-template>
</nb-step>
</nb-stepper>
我尝试使用选定的属性,但没有帮助
答案 0 :(得分:0)
Get query params在组件中,并使用该参数设置所选步骤,以便在组件中使用
selectedStep='second';
constructor(activatedRoute:ActivatedRoute){
this.activatedRoute.queryParams.subscribe((data)=>{
if(data['step']){
this.selectedStep =data['step']
}
})
}
和html
<nb-stepper [selected]="selectedStep">