File

packages/ecl/components/ecl-rating-field/ecl-rating-field.component.ts

Description

Component representing rating field, displayed with stars. Typically used when the user needs to evaluate something.

Extends

ECLBaseDirective

Implements

ControlValueAccessor

Metadata

Index

Methods
Inputs
Outputs
HostBindings
Accessors

Inputs

disabled
Type : boolean

Can be used to set disabled status.

name
Type : string
Default value : 'rating'

Name of the radio group. Also used for creating id for each radio button.

numberOfStars
Type : number
Default value : 5

How many stars should the rating have.

rating
Type : number

The initial value, if any.

class
Type : string
e2eAttr
Type : any
tabindex
Type : number

Outputs

ratingChange
Type : EventEmitter

The event to be emitted when rating is changed.

HostBindings

class
Type : string

Applies the base class ecl-rating-field to the host element. Applies 'ecl-rating-field--disabled' class on condition.

Methods

onRadioClick
onRadioClick(rating: number)

Method that sets the new rating and emit 'ratingChange' event, that includes the new rating number.

Parameters :
Name Type Optional Description
rating number No
  • the new rating
Returns : void
registerOnChange
registerOnChange(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
registerOnTouched
registerOnTouched(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
setDisabledState
setDisabledState(isDisabled: boolean)

Disable/enable component.

Parameters :
Name Type Optional
isDisabled boolean No
Returns : void
writeValue
writeValue(value: number)

Informs the component of any changes in the parent (ControlValueAccessor). Sets the new value for the 'rating' property.

Parameters :
Name Type Optional
value number No
Returns : void
getCssClasses
getCssClasses(rootClass: string)
Parameters :
Name Type Optional
rootClass string No
Returns : string

Accessors

numbers
getnumbers()

Array of numbers, from 1 to 'numberOfStars'

Returns : Array<number>
cssClasses
getcssClasses()

Applies the base class ecl-rating-field to the host element. Applies 'ecl-rating-field--disabled' class on condition.

Returns : string

results matching ""

    No results matching ""