2

I am getting above error for following code: I have checcked for typos.

component:

<aura:component >

<aura:attribute name="Result" type="Integer" />
<ui:inputNumber aura:id="inputOne" label="Enter first number" />
<ui:inputNumber aura:id="inputTwo" label="Enter second number" />
<ui:inputNumber aura:id="inputThree" label="Enter third number" />
<ui:button aura:id="calculateButton" label="Calculate" press="{!c.calculate}"    />

<div>
    Output: <ui:outputNumber aura:id= "totalValue" value="{!c.Result}" />
</div>

Controller:

({
calculate : function(component, event, helper) {
    var a= component.find('inputOne').get('v.value');
    var b= component.find('inputTwo').get('v.value');
    var c= component.find('inputThree').get('v.value');

    var resultCalc=a+b-c;
    //console.log('Values are: '+a+b+c+result);
    component.set("v.Result", resultCalc);
}
})

Application:

<aura:application >
<c:CalculateTotal />
</aura:application>

2 Answers 2

2
Output: <ui:outputNumber aura:id= "totalValue" value="{!c.Result}" /> 

change it to

Output: <ui:outputNumber aura:id= "totalValue" value="{!v.Result}" />
1

The updated code is as below

<aura:component >

<aura:attribute name="Result" type="Integer" />
<ui:inputNumber aura:id="inputOne" label="Enter first number" />
 <ui:inputNumber aura:id="inputTwo" label="Enter second number" />
 <ui:inputNumber aura:id="inputThree" label="Enter third number" />
 <ui:button aura:id="calculateButton" label="Calculate" press="{!c.calculate}"    />

<div>
Output: <ui:outputNumber aura:id="totalValue" value="{!v.Result}" />
</div>

"c" is reserved for actions and v is reserved for attributes or values

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .