Angular 5材质微调器不起作用 [英] Angular 5 Material Spinner is not working

查看:91
本文介绍了Angular 5材质微调器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular 5材质微调器不起作用

Angular 5 Material Spinner is not working

app.module.ts

app.module.ts

import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
@NgModule({
  imports: [
    MatProgressSpinnerModule
  ]})

component.ts

component.ts

import { MatSpinner } from '@angular/material';

component.html

component.html

<mat-spinner></mat-spinner>

我缺少任何配置吗??

am I missing any configuration.?

参考中,它正在为Spinner生成SVG文件,但是我没有在mat-spinner标签内看不到任何东西.

In Reference, it's generating an SVG file for Spinner but I don't see anything inside mat-spinner tag.

推荐答案

我尝试添加给出的mat-spinner示例,并且效果很好.我能看到的唯一区别是导入进度微调器模块的方式,而不是从特定路径导入它的方式:

I tried to fork the mat-spinner example given and that works perfectly. The only difference that I could see is the way you import the progress spinner module instead of importing it from a specific path do this:

  import { MatProgressSpinnerModule } from '@angular/material';

当mat-spinner扩展了matprogressSpinner时,您不需要在组件内部导入任何内容.

You don`t need to import anything inside your component as mat-spinner extends matprogressSpinner.

在相关html内执行您正在做的事情,即

Inside the relevant html just do what you were doing i.e.

<mat-spinner></mat-spinner>

您可以查看以下内容: https://stackblitz.com/angular/eymjpelkpro 可能会为您提供更多背景信息.

You can have a look at this: https://stackblitz.com/angular/eymjpelkpro which might give you some more context.

这篇关于Angular 5材质微调器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆