You need to sign in to do that
Don't have an account?
Chandan Kumar 100
my question is related to Attribute
MY component is
<aura:component >
<aura:attribute name="num1" type ="integer" default ="30"/>
<aura:attribute name="num2" type ="integer" default ="10"/>
<aura:attribute name="sum" type ="integer"/>
{!v.num1}+{!v.num2} = {!v.sum}
<!--Press button to add numbers and display sum-->
<br></br>
<ui:button label="Add Numbers" press="{!c.add}"/>
</aura:component>
====================================================================================
CONTROLLER
({
add : function(component) {
var addval=component.get("v.num1") + component.get("v.num2");
component.set("v.sum",addval);
}
})
And error is
This page has an error. You might just need to refresh it.
Unknown controller action 'add' Failing descriptor: {markup://devloper:addcmp}
Please solve
Thanks
Chandan
<aura:component >
<aura:attribute name="num1" type ="integer" default ="30"/>
<aura:attribute name="num2" type ="integer" default ="10"/>
<aura:attribute name="sum" type ="integer"/>
{!v.num1}+{!v.num2} = {!v.sum}
<!--Press button to add numbers and display sum-->
<br></br>
<ui:button label="Add Numbers" press="{!c.add}"/>
</aura:component>
====================================================================================
CONTROLLER
({
add : function(component) {
var addval=component.get("v.num1") + component.get("v.num2");
component.set("v.sum",addval);
}
})
And error is
This page has an error. You might just need to refresh it.
Unknown controller action 'add' Failing descriptor: {markup://devloper:addcmp}
Please solve
Thanks
Chandan
I tried your code, and it works. Did you miss something to show us?
May I request you to please confirm you have added js code in controller, not helper class?
Still, if the problem persists please give a try by creating a new component with same code which should probably resolve the issue.
Hope this helps.
Please mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra
All Answers
I tried your code, and it works. Did you miss something to show us?
May I request you to please confirm you have added js code in controller, not helper class?
Still, if the problem persists please give a try by creating a new component with same code which should probably resolve the issue.
Hope this helps.
Please mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra