fraserxu / fraserxu/ionic-rating

Issue when displaying half stars

Open
#24 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
141
Forks
55
PR merge metrics
No merged PRs in 30d

Description

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 `` get the class `ion-ios-star`):
``

I got to do it to work:

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

``

I hope it may help. Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the direct ng-model case with a 2.5 rating and compare it with the workaround using an intermediate ratings object. Inspect the rating directive's scope and model handling; done means a direct user.rating value of 2.5 renders the half-star state without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, coffeescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.