0

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");
        /*if(createCarRecord){
            component.set("component.showNew",true);
        }else{
            component.set("component.showNew",false);
        }*/

        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

1

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

  • Thank You so much.. – Krishna N Jul 26 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.