Я хочу создать индикатор выполнения, но процент не отображается правильно - PullRequest
0 голосов
/ 21 ноября 2018

Мне нужно создать индикатор выполнения, который обновляет некоторые значения.Итак, я создал компонент.

процент (РЕБЕНОК):

<div class="row">
    <div class="col-md-12">
        <p>This progress bar uses the customized default values, but changes the type using an input.</p>
        <p><ngb-progressbar type="warning" [value]="currentValuePercentage" [striped]="true" [animated]="true" #bar><i>{{currentValuePercentage}}%</i></ngb-progressbar></p>
    </div>
  </div>

.ts:

currentValuePercentage: number = 0;
  constructor() { }

  ngOnInit() {

  }

  ngOnChanges(changes: SimpleChanges) {
    console.log(changes);
    if (changes && changes.currentPercentageIncrement) {
      this.currentValuePercentage = this.currentValuePercentage+Number(changes.currentPercentageIncrement);

    }

  }

ОТЕЦ HTML-компонент:

<app-percentage #display_percentage></app-percentage>

ОТЕЦ .js:

@ViewChild('display_percentage') display_percentage;
//This is called when my father do some operation and so I need to update percentge
this.display_percentage.ngOnChanges({currentPercentageIncrement:(100/this.listMovimenti.length)});

Проблема заключается в правильном увеличении процентано индикатор выполнения не обновляется правильно.Подробно, индикатор выполнения не обновляется, а начинается с 0% и отображается только при процентном соотношении 100%.

...