【发布时间】:2019-02-13 01:10:29
【问题描述】:
我的 HTML
<mat-form-field class="button-spacing">
<mat-select placeholder="select" [(ngModel)]="dropDownOne">
<mat-option *ngFor="let first of test1" [value]="first"> {{ first }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="button-spacing">
<mat-select placeholder="select" [(ngModel)]="DropDownTwo" (change)="on()" [hidden]="show" [disabled]="dropDownOne== 'One'||dropDownOne == undefined ">
<mat-option *ngFor="let second of test2" [value]="second"> {{ second }}
</mat-option>
</mat-select>
</mat-form-field>
我的 TS
import { Component } from '@angular/core';
import { MatTableDataSource } from '@angular/material';
/**
* @title Basic use of `<table mat-table>`
*/
@Component({
selector: 'table-basic-example',
styleUrls: ['table-basic-example.css'],
templateUrl: 'table-basic-example.html',
})
export class TableBasicExample {
test1 =[
'One',
'Two'
]
test2 =[
1,2,3,4
]
show :boolean = true;
on(){
this.show = !this.show;
}
}
如何在此处隐藏/显示下拉菜单。! 在第一个下拉菜单中,当我单击一个时,我有“一个”和“两个”之类的选项,第二个下拉菜单必须隐藏而不是禁用,当我首先从下拉菜单中单击“两个”选项时,将显示第二个下拉菜单对我们怎么样??
这是我的 StackBliz 链接 --> https://stackblitz.com/edit/drow-down-disabled12345677709-gfj1-gxqswz
【问题讨论】:
标签: angular typescript angular-material