Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when displaying half stars #24

Open
glaucocustodio opened this issue Jan 18, 2016 · 3 comments
Open

Issue when displaying half stars #24

glaucocustodio opened this issue Jan 18, 2016 · 3 comments

Comments

@glaucocustodio
Copy link

Hi guys, I am using the latest version (from master) of ionic-rating and I had a issue with that. I don't know much how to explain, but I know it's related with variable scoping.

In a screen I show user data I have something like:
$scope.user = {id: 1, name: 'Foo', rating: 2.5}

In template if I use like below, It only shows 3 stars (the last <i> get the class ion-ios-star):
<rating class="xs-rating" ng-model="user.rating" max="5" readonly="true"></rating>

I got to do it to work:

$scope.ratings = {}
$scope.ratings[$scope.user.id] = $scope.user.rating

<rating ng-repeat="c in ratings" class="xs-rating" ng-model="c" max="max" readonly="true"></rating>

I hope it may help. Thanks.

@vlafranca
Copy link
Contributor

Hi,
I will try to investigate on this on my own, but in the mean time could you please post a codepen reproducing your issue ? It would be very helpful !

Thanks

EDIT : I made a codepen to show how to use the directive, telle me if it helps :
http://codepen.io/vlafranca/pen/GoxVKL

@rebelchris
Copy link

The issue occurs if the rate comes after the init, i'm having the same issue.

So lets say you want to fetch the rating trough a database, and then set the rating.rate it rounds up (acts like a click)

http://codepen.io/rebelchris/pen/xZevKX

@vlafranca
Copy link
Contributor

Hi,
I fixed it and made a pull request.

fraserxu added a commit that referenced this issue Feb 20, 2016
Fix delayed half star display (issue #24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants