× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Loading dependencies for a custom component(directive)

Daniel Olano
Aug 15, 2015
<p>As discussed in the session, your requirement of creating a directive to load dependencies for a component is possible but not recommended.</p> <p>What I recommend and what should be done, is to use a known module loader which loads js files dynamically at run-time and on demand, like requireJs(AMD), browserify(CommonJs) or new ECMAScript6 import syntax(SystemJs). Those are well tested solutions used on many big applications that want to solve the dynamic loading of files.</p> <p>Using the requested 'dependencies' loader directive will be a bit hacky and will add an extra layer of complexity to the writing of components. Create it ONLY if you don't know the dependencies of your component beforehand, if the dependencies are resolved when the application is running.</p>
comments powered by Disqus