Skip to main content
Hello , I was trying to complete all challenge about lightining, i was able to pass all of them except "Using Javascript Controller with Components" challenge. I was not able to figure out why trailhead gives the  error below  :

Here is my component :

 

<aura:component >

<ui:inputNumber aura:id="inputOne" onError='{!c.handleError}' /> <br />

<ui:inputNumber aura:id="inputTwo" onError='{!c.handleError}' /> <br/>

<ui:inputNumber aura:id="inputThree" onError='{!c.handleError}' /> <br/>

<ui:outputNumber aura:id="totalValue" value="" /><br/>

<ui:button label="Calculate" press="{!c.calculate}"/>

</aura:component>

and here is my js controler :

 

({

calculate : function(component, event, helper) {

var inputFirst = component.find("inputOne").get("v.value");

var inputSecond = component.find("inputTwo").get("v.value");

var inputThird = component.find("inputThree").get("v.value");

var total = parseInt(inputFirst) + parseInt(inputSecond) - parseInt(inputThird);

component.find("totalValue").set("v.value",total);

}

})

Thanks.

 
4 个回答
  1. 2015年9月7日 18:21
    Meybe I found the reason:

    Line 6:

    var total = parseInt(inputFirst) + parseInt(inputSecond) - parseInt(inputThird);

    Replace with (It must be sum):

    var total = parseInt(inputFirst) + parseInt(inputSecond) + parseInt(inputThird);

    Regards,

    Lukasz

     
0/9000