我在应用程序中使用了角度材质,基于循环和某些条件,我需要在ngAfterViewInit()的Mat-select中默认选择数据,并且mat-select会多次显示。 表示多个mat-select循环 *ngFor="let p of GlobalVariableService.controllsApplicationTypeFields;let filedIndex = index " 我正在创建多个mat-select代码 <div class="mt-3 example-full-width"
我正在使用角度材质,并使用材质选择。当用户做出选择时,我希望获取一个用户,它实际上是一个具有Id和description属性的对象。
<mat-form-field>
<mat-select placeholder="Select User Type" (selectionChange)="selectUserType(user)">
<mat-option *ngFor="let user of userTypeList" [value]="user.description
我使用mat-select material和Angular5。我陷入了无法将值绑定到mat-select中的*ngfor的问题中。
这些值是从rest API响应中获取的,我将其赋值给mat select中分配给ngfor的值。当我对其进行控制台操作时,我可以看到这些值,但是在html中,我无法获得该值。
html
<mat-select name="name" [(ngModel)]="nameselected">
<mat-optgroup *ngFor="let name of names" [label]="n
我尝试在angular material select中显示按钮,并使用以下代码:
<mat-select #placeNameControl="ngModel" placeholder="Place name">
<mat-option >
Add new place name
</mat-option>
<mat-option *ngFor="let addedPlaceName of addedPlaceNames" [value]="addedPlaceName"
我在表单#1中得到:输入和选择。在表单#2中,相同的字段和复选框。当我单击复选框时,如何将表单#1的值传递给表单#2? HTML代码: <mat-form-field>
<input matInput placeholder="Nombre" formControlName="names" required>
<mat-error *ngIf= "f?.names?.errors?.required">
Name field empty or not valid, please check
我有一个带有一个angular material stepper的form field,验证似乎是有效的,就好像没有选择任何东西一样,您不会提前。但是,我得到一个控制台错误,不知道它意味着什么。
以下是我的HTML:
<mat-horizontal-stepper linear #stepper>
<mat-step [stepControl]="frmUserDetails">
<ng-template matStepLabel>Service User Details</ng-template>