Skip to content

Commit

Permalink
fix(increment): fixed increment function
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Apr 12, 2017
1 parent 2d53cd5 commit 0f0e911
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/angular2/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class AppComponent {
this.starRatingConfig = {};

this.starRatingConfig.id = 1221;
this.starRatingConfig.rating = 2.72368;
this.starRatingConfig.rating = 2.22368;
this.starRatingConfig.showHalfStars = true;
this.starRatingConfig.numOfStars = 7;
this.starRatingConfig.size = "large";
Expand Down
8 changes: 1 addition & 7 deletions src/star-rating.component.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/star-rating.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ export class StarRatingController {
}

increment() {
//increment to net higher step
//increment to next higher step
let absDiff = Math.abs(this.rating%this.step);
this.rating = this.rating + (absDiff>0?absDiff:this.step);
this.rating = this.rating + (absDiff>0?this.step - absDiff:this.step);
}

decrement() {
Expand Down

0 comments on commit 0f0e911

Please sign in to comment.