简体   繁体   English

物料踏步机无法评估角度5

[英]Material stepper prevent evaluating angular 5

In my angular 5 project I have a material-stepper . 在我的有角5项目中,我有一个材料步进器 My stepper has 2 pages, the first page has 2 buttons, one is the next button to go to the next stepper page if the form in the page is correct. 我的步进器有2页,第一页有2个按钮,如果页面中的表单正确,则一个按钮是转到下一个步进器页面的下一个按钮。

<button mat-button matStepperNext (click)="sendFareRequest()" 
   class="btn btn-info btn-round pull-right">next
        <span class="btn-label">
            <i class="material-icons">keyboard_arrow_right</i>
        </span>
</button>

The second button have to open a modal (sweetalert), but in this case I see all the required fields in the stepper page highlighted in red, like if the form is evaluated, I don't want this, the second button doesn't have the matStepperNext So I don't know why this happening. 第二个按钮必须打开一个模态(sweetalert),但是在这种情况下,我看到步进页面中所有必填字段都以红色突出显示,例如如果对表单进行了评估,我不希望这样做,第二个按钮则不会有matStepperNext所以我不知道为什么会这样。

<button mat-button (click)="alertTicketMissing()" class="btn btn-label btn-round">
    {{ 'ticket.new.buttons.numberpassnotfound' | translate}}
    <span class="btn-label">
        <i class="material-icons">close</i>
    </span>
</button>

You have a set a type="button" on your button triggering the alert. 您在触发警报的按钮上设置了type =“ button”。 By default all button without a type behaves like a submit button, thus submit the form. 默认情况下,所有没有类型的按钮的行为都类似于提交按钮,因此提交表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM