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
Chandan Kumar 100Chandan 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
Best Answer chosen by Chandan Kumar 100
NagendraNagendra (Salesforce Developers) 
Hi 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

Yogini K 7Yogini K 7
This code is working correctly. Did you miss anything to mention?
NagendraNagendra (Salesforce Developers) 
Hi 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
This was selected as the best answer
Chandan Kumar 100Chandan Kumar 100
Yer this code is run properly Thanks --- Original Message ---