import { Component, OnInit } from '@angular/core';
@Component({
selector: 'mat-demo-select',
template: `
`,
styleUrls: ['./mat-demo-select.component.less']
})
export class MatDemoSelectComponent implements OnInit {
options = [];
selectedOption;
searchOptions;
selectedMultipleOption;
ngOnInit() {
/*模拟服务器异步加载*/
setTimeout(_ => {
this.options = [
{ value: 'jack', label: 'Jack' },
{ value: 'lucy', label: 'Lucy' },
{ value: 'disabled', label: 'Disabled', disabled: true }
];
this.selectedOption = this.options[ 0 ];
this.searchOptions = [
{ value: 'Dandelion', label: '丹德里恩' },
{ value: 'Zoltan ', label: '卓尔坦' },
{ value: 'Priscilla', label: '普西拉' },
{ value: 'Vesemir', label: '维瑟米尔' },
{ value: 'Triss', label: '特莉丝·梅利葛德' },
{ value: 'Eredin', label: '艾瑞汀' }
];
this.selectedMultipleOption = [ 'tom' ];
}, 100);
}
}