hughjdavey/ngx-stars

Update initialStars

cviloria opened this issue ยท 3 comments

Greetings, I have run into a small problem when changing the value of the variable initialStars the component does not update the score.

I am using ngx-starts in a component of my own in which that value can change if my users change scores of some topics.

Additionally I was able to adjust the problem using switch in my html, since I can see that there is no event that captures the changes of the variable to update the stars

Hi @cviloria I'm not sure exactly what you mean - do you mean you are trying to update the value by changing initialStars at runtime? If so there's a better way to do it with the component's setRating method. Here is an example:

export class MyComponent {

  @ViewChild(NgxStarsComponent)
  starsComponent: NgxStarsComponent;

  ...

  // when you want to update the stars in code
  this.starsComponent.setRating(0);
}

Let me know if this helps you, or if your problem is something else ๐Ÿ‘

Hi @cviloria did you solve your issue?

Hi @cviloria did you solve your issue?

Thanks today I have been able to test this solution and it works for my implementation