材料选择不在angular5组件上显示

时间:2018-02-03 21:05:31

标签: angular angular-material

我正在使用Angular Material" MatSelectModule"当我在控制器中调用时选择选项,选择选项就像文本段落一样并排。

TypeScript文件:

printf("%d\n", len);
printf("%d\n", upper);
printf("%d\n", lower);
printf("%d\n", digit);
printf("%d\n", special);

组件:

import { Component, OnInit, NgModule } from '@angular/core';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material';

@Component({
  selector: 'app-schedule-call',
  templateUrl: './schedule-call.component.html',
  styleUrls: ['./schedule-call.component.scss']
})


@NgModule({
  imports: [
    MatRadioModule,
    MatSelectModule
  ]
})


export class ScheduleCallComponent implements OnInit {
  foods = [
    {value: 'steak-0', viewValue: 'Steak'},
    {value: 'pizza-1', viewValue: 'Pizza'},
    {value: 'tacos-2', viewValue: 'Tacos'}
  ];
}

1 个答案:

答案 0 :(得分:1)

在使用任何@ angular / material组件之前,请导入如下主题:

@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';

有关在此处自定义主题的详细信息:https://material.angular.io/guide/theming