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[]">
2
  • 1
    my component doesn't implements forceCommunity:availableForAllPageTypes or any other interface. Commented Dec 19, 2016 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
    Commented Dec 19, 2016 at 7:10

1 Answer 1

4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .