5

While creating a lightning component dynamically getting error message

Definition does not exist on the client for descriptor:markup://c:ComponentName

but error is getting resolved by making attributes and component global, but i don't want to make my component global for some reasons.

Any help what to do ??

My code : my component that i'm trying to create dynamically :

    <aura:component access="public">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute access="public" name="text" type="String" default=""/>
    {!v.text}
</aura:component>

my another component controller that is trying to create above component dynamically :

$A.createComponent("c:ComponentName", {
            'text' : 'my sample text'
        }, function(cmp, status, errorMessage) {
            if (status === "SUCCESS") {
                var cmpBody = component.get("v.cmpBody");
                cmpBody.push(cmp);
                component.set("v.cmpBody", cmpBody);
            }
            if (status === "INCOMPLETE") {}
            if (status === "ERROR") {}
        });

my component attribute(cmpBody) is defined as follows :

<aura:attribute name="cmpBody" type="Aura.Component[]">
  • 1
    my component doesn't implements forceCommunity:availableForAllPageTypes or any other interface. – Ashwani Kumar Dec 19 '16 at 4:49
  • 2
    Can you share the code where you are using Aura.createcomponent? it will be easier for us to help you. – manjit5190 Dec 19 '16 at 7:10
4

Use namespace instead of c in $Lightning.use() and $Lightning.createComponent()

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.