function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DEBADYUTI SIL 39DEBADYUTI SIL 39 

Scripts seems not loading while creating component dynamically

Hi,

  I am creating component dynamicaly usning code as below :
 
$A.createComponent(
                "c:M",yComponent",
                {},
                function(newCmp){
                    if (component.isValid()) {
                        var content = component.find("content");
                        content.set("v.body", newCmp);
                    }
                }
            );

Now i have couple of resources placed in app as below :
 
<!-- Bootstrap -->
    <ltng:require styles="/resource/resource/lib/bootstrap/css/bootstrap.min.css"/>
    
    
    <!-- Main CSS -->
    <ltng:require styles="/resource/resource/css/font.css"/>
    <ltng:require styles="/resource/resource/css/jquery.ui.css"/>
    <ltng:require styles="/resource/resource/css/jqtransform.css"/>
    <ltng:require styles="/resource/resource/css/screen.css"/>
    
    <!-- jQuery library -->
    <ltng:require scripts="/resource/resource/js/jquery-2.1.4.min.js,/resource/resource/js/jquery-ui.js,/resource/resource/js/hammer.min.js,/resource/resource/js/jquery.tablesorter.min.js,/resource/resource/js/jquery.jqtransform.js,/resource/resource/lib/bootstrap/js/bootstrap.min.js,/resource/scriptjs" />

When the component gets created in dom it's not able to use the script.It seems while the components gets created it can not use the scripts which are already loaded as part of app load.Any help will be great .
Michał Zadrużyński 2Michał Zadrużyński 2
load all js scripts in one line and define action to be executed after scripts are loaded (not on init):
<ltng:require scripts="/*all your scripts here8?" afterScriptsLoaded="{!c.doAfterScriptsLoaded}"/> 
// where doAfterScriptsLoaded is function in controller where you execute actions that depends on script