Unable to save the controller file in Lightning when i try to add below line to my code.

Var createCarRecord = $A.get("e.force:createRecord");

Full code after adding above line is

    doinit : function(component, event, helper) {
        //will fetch from backend
        Var createCarRecord = $A.get("e.force:createRecord");

        component.set("v.carTypes",['Sports Car','Luxury Car','Van']);
        var cartype = component.get("v.carTypes")

when i try to save i'm getting the error

enter image description here


Its because of Var. It should be var. Its case sensitive.

  • Thank You so much.. – Krishna N Jul 26 '19 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.