Angular2 Material2 <md-spinner> 未显示但正在工作

标签 angular angular-material2

我的假设是我的 css 不正确,但可惜我无法弄清楚。

<div *ngIf="loading">
  <md-progress-circle mode="indeterminate" color="warn">Loading...</md-progress-circle>
</div>
<md-list>
  <md-list-item *ngFor="let incident of incidents">
    <h3 md-line> {{name}} </h3>
    <p md-line>
      <span>{{date}} > </span>
      <span>{{text}}</span>
    </p>
  </md-list-item>
</md-list>

enter image description here

最佳答案

您需要确保您使用的是@angular/material 的主题。

来自getting started guide :

Include the core and theme styles:

This is required to apply all of the core and theme styles to your application. You can either use a pre-built theme, or define your own custom theme.

我发现在没有主题的情况下使用@angular/material 只能在某些时候起作用。文本输入有效,但单选按钮、复选框 - 看起来是微调器 - 需要主题才能正常工作。

如引用中所述,您可以使用提供的主题之一(目​​前提供 6 个)或创建您自己的主题。提供的主题可以使用 @import('~@angular/material/core/theming/prebuilt/<theme>.css') 包含在您的 css 中。 .

关于Angular2 Material2 <md-spinner> 未显示但正在工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41582139/

相关文章:

html - Angular 不渲染从组件中提取的 HTML?

angular - 如何在 Angular Material Grid 中设置行距?

angular - 如何使用 Angular 5 对 HTTP GET 响应进行排序以一次获取一个元素

html - using/deep/in angular 4 component.css 导致其他组件使用相同的样式。如何解决?

angular - Angular Material 2 中的背景颜色不会在明暗主题之间切换

angular - check_box_outline 图标占用额外空间

angular - 如何使用 forFeature 而不用于延迟加载模块?

android - 当您的应用程序在后台运行时,Ionic 如何通过摇动打开您的应用程序?

javascript - 如何使用 Angular 6 禁用基于循环中特定值的复选框?

javascript - 在使用该服务的所有组件中显示 Angular 服务中的更改