2

main.cmp

<aura:application >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:handler event="c:NavigateToDetailPage" action="{!c.NavigateComponent}" />{!v.body}
</aura:application>

main.js

({
    doInit : function(component, event, helper) {
        $A.createComponent(
            "c:contactEdit",
            {

            },
            function(newCmp){
                if (component.isValid()) {
                    component.set("v.body", newCmp);
                }
            }
        );
    },

    NavigateComponent : function(component, event, helper) {
        var a = event.getParam("result");
        $A.createComponent(
            "c:contactDetailCmp",
            {
                "conObj" : event.getParam("result")
            },
            function(newCmp){
                if (component.isValid()) {
                    component.set("v.body", newCmp);
                }
            }
        );
    } 
})
  • 3
    Can you give more details on what's not working ? – Fabien Taillon Nov 16 '16 at 10:26
  • is the component created successfull in both cases? what status says? Tracking status argument in a callback function helps in troubleshooting – Pavlonator Nov 16 '16 at 14:46

Your Answer

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

Browse other questions tagged or ask your own question.