Answer the question
In order to leave comments, you need to log in
How to implement lazy loading of components in Angular 2?
How to implement lazy loading of components in Angular 2 (specifically - in the RC version)?
Answer the question
In order to leave comments, you need to log in
Because at the moment, creating a component from a string is not yet implemented
function resolveComponent(resolver, snapshot) {
// TODO: vsavkin change to typeof snapshot.component === 'string' in beta2
if (snapshot.component && snapshot._routeConfig) {
return resolver.resolveComponent(snapshot.component);
}
else {
return Promise.resolve(null);
}
}
RuntimeCompiler.prototype.resolveComponent = function (component) {
if (isString(component)) {
return PromiseWrapper.reject(new BaseException$1("Cannot resolve component using '" + component + "'."), null);
}
return this.compileComponentAsync(component);
};
WebPack allows you to upload on demand
require.ensure(['jquery'], function(require) {
require("jquery");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question