You need to sign in to do that
Don't have an account?
Vignesh Ramshetty
How to shoe records on Aura getting error with below code
Apex Class:
Public with sharing class AccountHealper{
@AuraEnabled (cacheable=true)
public static List<Account> getfunction() {
list<Account> varacclist = new list<Account> ();
varacclist = [SELECT id, Name FROM Account];
Return varacclist;
}
}
<aura:component controller = "AccountHealper">
<aura:attribute name = "contactlist" type = "object"/>
<lightning:button label = "click here" onclick = "{!c.handeler}"/>
<aura:iteration items = "{!v.contactlist}" var = "varcon"/>
<p> {!varcon}</p>
</aura:component>
({
handeler : function(event,component,helper){
var action = component.get("c.getfunction");
action.setCallback(this,function(responce){
var state = response.getState();
if(state == "SUCCESS"){
var result = response.getReturnValue();
component.set("v.contactlist",result);
}
});
$A.enqueueAction(action);
}
})
This page has an error. You might just need to refresh it. Action failed: c:ittortercomponent$controller$handeler [component.get is not a function] Failing descriptor: {c:ittortercomponent$controller$handeler}
Public with sharing class AccountHealper{
@AuraEnabled (cacheable=true)
public static List<Account> getfunction() {
list<Account> varacclist = new list<Account> ();
varacclist = [SELECT id, Name FROM Account];
Return varacclist;
}
}
<aura:component controller = "AccountHealper">
<aura:attribute name = "contactlist" type = "object"/>
<lightning:button label = "click here" onclick = "{!c.handeler}"/>
<aura:iteration items = "{!v.contactlist}" var = "varcon"/>
<p> {!varcon}</p>
</aura:component>
({
handeler : function(event,component,helper){
var action = component.get("c.getfunction");
action.setCallback(this,function(responce){
var state = response.getState();
if(state == "SUCCESS"){
var result = response.getReturnValue();
component.set("v.contactlist",result);
}
});
$A.enqueueAction(action);
}
})
This page has an error. You might just need to refresh it. Action failed: c:ittortercomponent$controller$handeler [component.get is not a function] Failing descriptor: {c:ittortercomponent$controller$handeler}
Can you try the below Aura Component. First no need of onclick button you can use init method for it. If you still need onlick you can use the same.
Aura:
Aura Contraoller:
Aura Helper:
Apex Class:
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
All Answers
Can you try the below Aura Component. First no need of onclick button you can use init method for it. If you still need onlick you can use the same.
Aura:
Aura Contraoller:
Aura Helper:
Apex Class:
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,