I am trying to complete challenge 2 of Lightning Framework specialist.
The form’s controller checks whether the event.force:createRecord event is supported by a standalone app and either shows or hides the New button according to best practices.
I am using the followign piece of code for the above requirement.
In Lightning Component
<aura:attribute name="isNewEnabled" type="Boolean"/>
<aura:if isTrue = "{!v.isNewEnabled}">
<lightning:layoutItem flexibility="grow">
<lightning:button label="New" class="slds-button slds-button_neutral"/>
</lightning:layoutItem>
</aura:if>
In Lightning Component Js Controller
var isEnabled = $A.get("e.force:createRecord");
console.log('**8&&&&'+$A.get('e.force:createRecord'));
if(isEnabled){
component.set(isNewEnabled, true);
}
However, the console is printing the value as undefined as a result of which the button is not being rendered in my desktop.
Is this the correct way to implement the above?