[英]How to keep the position of the Angular select options with the field?
在使用ng2-google-charts和angular-material時,select 列表位於圖表下方,而控件位於圖表上方。 我如何將這些放在一起?
<mat-form-field>
<mat-label>Continent</mat-label>
<mat-select [(ngModel)]="continents" (change)="onSelectContinent()">
<mat-option *ngFor="let continent of continents | keyvalue" [value]="continent.key">{{continent.value}}</mat-option>
</mat-select>
</mat-form-field>
select 列表是 ini cdk-overlay-container html 元素,它在<app_root>元素之外呈現。
模塊導入
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatSelectModule} from '@angular/material/select';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatButtonModule} from '@angular/material/button';
我錯過了一個主題
添加
https://material.angular.io/guide/theming#defining-a-custom-theme
到 styles.css 文件的頂部,如在此處輸入鏈接描述中所述
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.