Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

[uib-rating] disable reset to zero (feature) #5532

Closed
@startswithaj

Description

@startswithaj

Bug description:

When using the uib-rating directive if you click the star of the current value (i.e 3rd star selected. click 3rd star again) it sets the current value to 0 essentially resetting the rating.

The code that does this:

ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue === value ? 0 : value);

Version of Angular, UIBS, and Bootstrap: Current

My current use case:

Rating defaults to 3/5 and should not be able to be set to zero.

Proposed fixes:

  1. attr.disableClear

If set to true then when clicking the current value would just set the value again.

  1. attr.min (minimum)

The uib-control would not allow a rating less than the given int. ie In the use case above i would set min=1. If the user click 3 rating while already selected it would reset back to 1 rather than zero.

I would be happy to code and submit a pull request for this feature if it would likely be merged.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions