我有一个角形表格,用于添加和编辑记录。我希望这个提交按钮在表单之外。
我正在使用 mat 对话框并希望 mat-dialog 操作标记中的提交按钮。我在对话框的操作部分中放置的提交按钮不会使表单提交。
<h2 mat-dialog-title>
<h1 class="pb-4" style="padding-left: 50px">
<span *ngIf="!userId">Add new</span><span *ngIf="userId">Update</span> user
</h1>
</h2>
<mat-dialog-content class="mat-typography">
<div class="dialog-padding">
<ng-container *ngIf="isLoading$ | async">
<div class="overlay-layer bg-transparent">
<div class="spinner spinner-lg spinner-success"></div>
</div>
</ng-container>
<div>
<form
#myform="ngForm"
class="form"
id="kt_form"
(ngSubmit)="save(myform)"
>
<div class="panel panel-primary">
<div class="panel-body">
<div class="row">
<div class="col-xl-12">
<div class="form-group">
<label class="control-label" for="name">Name</label>
<input
required
type="text"
[(ngModel)]="model.name"
class="form-control form-control-solid"
placeholder=""
name="name"
#name="ngModel"
/>
</div>
</div>
</div>
<div class="row pt-4" style="border-top: 1px solid #f5f5f5">
<div class="col-xl-6"></div>
<div class="col-xl-6">
<div class="form-group">
<button class="btn btn-primary width-100">
{{ neworUpdate }} user
</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button
mat-button
[mat-dialog-close]="true"
cdkFocusInitial
class="btn btn-primary btn-pointer"
>
Install
</button>
<button mat-button mat-dialog-close class="btn btn-primary btn-pointer">
Cancel
</button>
</mat-dialog-actions>