[英]Material <mat-select> not displaying properly in Ionic/Angular Project
I'm trying to add a <mat-select>
into my Ionic/Angular project but it isn't rendering properly..我正在尝试将
<mat-select>
添加到我的 Ionic/Angular 项目中,但它没有正确呈现。
I'm using angular-material doc我正在使用angular-material 文档
But this is the result displaying on my page:但这是我页面上显示的结果:
Here is my code:这是我的代码:
<ion-content>
<ion-title>Contact Us</ion-title>
<mat-form-field>
<mat-select>
<mat-option>None</mat-option>
<mat-option value="option1">Option 1</mat-option>
<mat-option value="option2">Option 2</mat-option>
<mat-option value="option3">Option 3</mat-option>
</mat-select>
</mat-form-field>
</ion-content>
Yes, I've imported MatFormFieldModule
, MatSelectModule
in both the module that I'm using it in, as well as my app.module.ts
.是的,我已经在我正在使用它的模块以及我的
MatSelectModule
中导入了MatFormFieldModule
和app.module.ts
。 I use other Material components in my Ionic project but for some reason, the <mat-select>
component just won't work.我在 Ionic 项目中使用了其他 Material 组件,但出于某种原因,
<mat-select>
组件无法正常工作。 I can't figure it out.我想不通。 I've tried re-building the project, re-importing angular/material.
我试过重建项目,重新导入角度/材料。 This gives no errors - just won't render properly
这没有错误 - 只是无法正确呈现
When I try doing the <mat-select>
with the *ngFor it does give an error such as: Can't bind to 'ngForOf' since it isn't a known property of 'mat-option'
当我尝试使用 *ngFor 执行
<mat-select>
时,它确实给出了一个错误,例如: Can't bind to 'ngForOf' since it isn't a known property of 'mat-option'
I really don't know what to do.我真的不知道该怎么办。
Any help is appreciated!任何帮助表示赞赏!
I figured it out.. I didn't have my contact.page
module imported into my app.module.ts, so it wasn't recognizing any other imports.我想通了.. 我没有将我的
contact.page
模块导入到我的 app.module.ts 中,所以它无法识别任何其他导入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.