function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Medhanie Habte 37Medhanie Habte 37 

Lightning Component Framework Specialist Superbadge Step 8

Hi All, I'm slowly but surely moving forward with this superbadge, but seem to be stuck on Step 8....

Challenge Not yet complete... here's what's wrong: 
The
FiveStarRating component doesn't have a change event listener that invokes a controller function named onValueChange. onValueChange should fire when the value attribute of the component is changed.
<aura:component implements="flexipage:availableForAllPageTypes">
	<aura:attribute name="value" type="Integer" default="0"/>
    <aura:attribute name="readOnly" type="boolean"/>
       <aura:handler name="onValueChange" value="{!v.value}" action="{!c.onValueChange}"/>
</aura:component>
 
({
	afterScriptsLoaded : function(component, event, helper) {

    // var domEl = [get dom element of rating area]
    // var currentRating = [get value attribute of component]
    // var readOnly = [get readonly attribute of component]

    var maxRating = 5;

    var callback = function(rating) {
    component.set('v.value',rating);
    }
    component.ratingObj = rating(domEl,currentRating,maxRating,callback,readOnly); 
},

onValueChange: function(component,event,helper) {
     if (component.ratingObj) {
        var value = component.get('v.value');
        component.ratingObj.setRating(value,false);
    }
}

		
	})

 
James LoghryJames Loghry

Change your aura:handler to the following and try revalidating:
 

<aura:handler name="change" value="{!v.value}" action="{!c.onValueChange}" />

Also, before you validate, you'll want to test your component to make sure it's working.