You need to sign in to do that
Don't have an account?
Anji Pavuluri
This page has an error. You might just need to refresh it. Action failed: c:Handler3$controller$test [componet is not defined] Failing descriptor: {c:Handler3$controller$test}
Handler3.cmp:
------------------
<aura:component >
<aura:attribute name="aval" type="Integer"/>
<aura:attribute name="bval" type="Integer"/>
<aura:attribute name="cval" type="Integer"/>
<aura:handler name="init" value="{!this}" action="{!c.test}"/>
<lightning:card title="Calculation">
A value:{!v.aval}<br/>
B value:{!v.bval}<br/>
C value:{!v.cval}
</lightning:card>
</aura:component>
Handler3Controller.js
----------------------------
({
test: function(component, event, helper) {
var a=component.get("v.aval");
var b=component.get("v.bval");
var cval=a+b;
componet.set("v.cval",cval);
}
})
Handler3_App.app
-------------------------
<aura:application extends ="force:slds">
<c:Handler3 aval="10" bval="20" />
</aura:application>
------------------
<aura:component >
<aura:attribute name="aval" type="Integer"/>
<aura:attribute name="bval" type="Integer"/>
<aura:attribute name="cval" type="Integer"/>
<aura:handler name="init" value="{!this}" action="{!c.test}"/>
<lightning:card title="Calculation">
A value:{!v.aval}<br/>
B value:{!v.bval}<br/>
C value:{!v.cval}
</lightning:card>
</aura:component>
Handler3Controller.js
----------------------------
({
test: function(component, event, helper) {
var a=component.get("v.aval");
var b=component.get("v.bval");
var cval=a+b;
componet.set("v.cval",cval);
}
})
Handler3_App.app
-------------------------
<aura:application extends ="force:slds">
<c:Handler3 aval="10" bval="20" />
</aura:application>
You have a spell mistake in your controller code.
Please try to paste as below and check: Hope above information helps. Please mark as Best Answer so that it can help others in future.
Thanks.
Hi Anji,
Please find the solution.
Actually, In your code, there is no data inside this variable "cval" so how you can set if there is no data.
I have correct your code if there is no data then it will not enter inside the if statement.
Please let me know it is working or not.
Please mark it as the Best Answer if it helps you.
Thank You