You need to sign in to do that
Don't have an account?
sekhar passam
My apex class\\
public with sharing class accountobj {
@AuraEnabled
public static list<account> getAccountss(){
list<account> accountss=[select id,name,phone,billingcity from account limit 100];
return accountss;
}
}
My component is
<aura:component controller="accountobj">
<aura:attribute name="accountss" type="account[]"/>
<ui:button label="Get accounts" press="{!c.getac}"/>
<aura:iteration var="account" items="{!v.accountss}">
<p>{!account.name}:{!account.phone}</p>
</aura:iteration>
</aura:component>
my controller js
({
getac:function(rec) {
var action=rec.get("c.getAccountss");
action.setcallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
rec.set("v.accountss",response.getReturnValue());
}
});
$A.enqueueAction(action);
}
})
This page has an error. You might just need to refresh it. Action failed: sekh:accountcom$controller$getac [action.setcallback is not a function] Failing descriptor: {sekh:accountcom$controller$getac}
My apex class\\
public with sharing class accountobj {
@AuraEnabled
public static list<account> getAccountss(){
list<account> accountss=[select id,name,phone,billingcity from account limit 100];
return accountss;
}
}
My component is
<aura:component controller="accountobj">
<aura:attribute name="accountss" type="account[]"/>
<ui:button label="Get accounts" press="{!c.getac}"/>
<aura:iteration var="account" items="{!v.accountss}">
<p>{!account.name}:{!account.phone}</p>
</aura:iteration>
</aura:component>
my controller js
({
getac:function(rec) {
var action=rec.get("c.getAccountss");
action.setcallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
rec.set("v.accountss",response.getReturnValue());
}
});
$A.enqueueAction(action);
}
})
Controller
All Answers
Controller