twitter-bootstrap 带角度 2 的 Bootstrap 进度条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39176865/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:15:15  来源:igfitidea点击:

Bootstrap progress bar with angular 2

twitter-bootstrapangular

提问by Kiran Kumar

I using bootstrap to show the progress bar. To change the value in the progress bar I am using Angular 2 Attribute Binding.

我使用引导程序来显示进度条。要更改进度条中的值,我使用了 Angular 2 属性绑定。

<div class="progress">
  <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" [attr.aria-valuenow]="progress" aria-valuemin="0" aria-valuemax ="100" 
  style="min-width: 2em;" [style.width]="(progress/100)*100 + '%'">
   {{progress}}%
  </div>

variable progress will be increasing when I upload a file and I am able to see the values in console log.

当我上传文件并且我能够在控制台日志中看到值时,可变进度会增加。

this.service.progress.subscribe(
data => {
    console.log('progress = '+data);
    this.progress = data;
    console.log(this.progress) ;
  });

Problem: The progress bar is showing 0 and then 100 once the upload is complete it is not progressing or showing in between values.please suggest.

问题:上传完成后,进度条显示 0 和 100,它没有进展或显示在值之间。请提出建议。

采纳答案by Kiran Kumar

There is no problem in the code. As the uploaded file size is very low it is quickly uploading. When i upload a bigger file it is working as expected.

代码没有问题。由于上传的文件大小非常小,因此上传速度很快。当我上传一个更大的文件时,它按预期工作。