izupet / angular2-counto

Angular 2 package for nice count animations
MIT License
40 stars 13 forks source link

ngFor local variables and binding #12

Closed Lsleiman closed 7 years ago

Lsleiman commented 7 years ago

Structural issue inside *ngFor. Looking at the code example below, a which is bound to the same event coming out of counto directive, is printing out the same value. Any way to bypass this?

> <var images would look like this [image : { url: someString, counter :  someNumber},{...}];
> <div  *ngFor="let image of images; let i = index" 
> <img src="image.url">
> <div  class="number" counto [step]="1000" [countTo]= "image.counter" [countFrom]="0" [duration]= "1" (countoChange)="a = $event">{{a | number:'1.0-0'}}</div>
> </div>
Lsleiman commented 7 years ago

No way to bypass this. This isn't an angular2-counto issue after all... I had to create a childComponent and re-render for each iteration of ngFor