You need to sign in to do that
Don't have an account?
satheesh p
Invalid literal value [1, 1]: 'edit': Source
i am using below code.
editReord.cmp
<aura:component>
<ui:button label="Edit Record" press="{!c.edit}"/>
</aura:component>
editRecordController.js
edit: function(component, event, helper)
{
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({ "recordId": component.get("v.contact.Id") });
editRecordEvent.fire();
}
when i am try to save controller it shows Invalid literal value [1, 1]: 'edit': Source.
what's error in the above code.
editReord.cmp
<aura:component>
<ui:button label="Edit Record" press="{!c.edit}"/>
</aura:component>
editRecordController.js
edit: function(component, event, helper)
{
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({ "recordId": component.get("v.contact.Id") });
editRecordEvent.fire();
}
when i am try to save controller it shows Invalid literal value [1, 1]: 'edit': Source.
what's error in the above code.
you got this error because
controller and helper javaScript code always wrap in parentheses and curly braces like ({....code here })
wrap your code inside it
({
edit: function(component, event, helper) {
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({ "recordId": component.get("v.contact.Id") });
editRecordEvent.fire();
}
})
and save it
if it helps you mark it best answer so it make proper solution for others
Thanks
All Answers
the below code should solve your issue
you got this error because
controller and helper javaScript code always wrap in parentheses and curly braces like ({....code here })
wrap your code inside it
({
edit: function(component, event, helper) {
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({ "recordId": component.get("v.contact.Id") });
editRecordEvent.fire();
}
})
and save it
if it helps you mark it best answer so it make proper solution for others
Thanks
THANKS!!
Am also facing same type of issue..thanks for providing the solution.might be its a best answer