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

feat(rating): allow decimal numbers as rating values #817

Merged
merged 1 commit into from
Sep 30, 2016

Conversation

maxokorokov
Copy link
Member

Part of #801

Allows for fine-grained rating values like 3.72.
Properly handles decimal numbers and template fill value when updated via [rate] binding.
Plus a small readonly demo.

screen shot 2016-09-29 at 15 39 54

/**
* internal
*/
getFillValue(index: number): number {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the JS doc comment. The way it is written right now it would show up in the API doc.

@pkozlowski-opensource
Copy link
Member

LGTM apart from the comment I've left.

<span *ngIf="fill === 100" class="star full">&hearts;</span>
<span *ngIf="fill === 0" class="star">&hearts;</span>
<span *ngIf="fill < 100 && fill > 0" class="star">
<span class="half" style.width="{{fill + '%'}}">&hearts;</span>&hearts;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style.width works like this so that one wouldn't need to use a binding?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could also write: [style.width.%]="fill" if I'm not mistaken.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda works both ways [style.width]="" and style.width='{{}}', but will try the one @pkozlowski-opensource is suggesting!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[style.width.%] works fine, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants