如何在Angular-4的md-progress-spinner中设置文本 [英] how to set text inside md-progress-spinner in Angular-4

查看:78
本文介绍了如何在Angular-4的md-progress-spinner中设置文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Angular-4中,我像这样设置进度微调器

In Angular-4 I am setting progress spinner like that

 <md-progress-spinner [color]="color" [mode]="mode" [value]="value" aria-label="Rating">Rating</md-progress-spinner>

以及ts中的值:

  color = 'warn';
  mode = 'determinate';
  value = 50;
  showText='Rating';

但是我想在进度栏中设置一些文本,我尝试使用angular-2方法,但是它在Angular-4中不起作用,有人可以告诉我它如何在Angular-4中完成

But I want to set some text inside the progress bar, I try to use angular-2 method but its not working in Angular-4 can anybody please tell me how its done in Angular-4

Angular-2的方法是设置[showText]='showText'

Angular-2 approach is to set [showText]='showText'

推荐答案

此功能在Material中不可用.您需要手动创建它.您可以将<mat-progress-spinner>放在<div>内,并在其中添加另一个<div>以显示文本并手动调整位置:

This feature in not available in Material. You need to create it manually. You can place the <mat-progress-spinner> inside a <div> and add another <div> inside that to display the text and adjust position manually:

<div>
    <mat-progress-spinner [color]="color" 
                        [mode]="mode" 
                        [value]="value" 
                        aria-label="Rating">
    </mat-progress-spinner>
    <div style="position:relative; top: -60px; left: 30px;">Rating</div>
</div>

链接到 stackblitz演示 .

这篇关于如何在Angular-4的md-progress-spinner中设置文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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