MOBILE-2795 compile: Show error on template parsing
parent
953c5ab0a4
commit
65d048c494
|
@ -102,6 +102,10 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
||||||
this.created.emit(this.componentRef.instance);
|
this.created.emit(this.componentRef.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.loaded = true;
|
||||||
|
}).catch((error) => {
|
||||||
|
this.domUtils.showErrorModal(error);
|
||||||
|
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,16 +170,20 @@ export class CoreCompileProvider {
|
||||||
// Now create the module containing the component.
|
// Now create the module containing the component.
|
||||||
const module = NgModule({imports: imports, declarations: [component]})(class {});
|
const module = NgModule({imports: imports, declarations: [component]})(class {});
|
||||||
|
|
||||||
// Compile the module and the component.
|
try {
|
||||||
return this.compiler.compileModuleAndAllComponentsAsync(module).then((factories) => {
|
// Compile the module and the component.
|
||||||
// Search and return the factory of the component we just created.
|
return this.compiler.compileModuleAndAllComponentsAsync(module).then((factories) => {
|
||||||
for (const i in factories.componentFactories) {
|
// Search and return the factory of the component we just created.
|
||||||
const factory = factories.componentFactories[i];
|
for (const i in factories.componentFactories) {
|
||||||
if (factory.componentType == component) {
|
const factory = factories.componentFactories[i];
|
||||||
return factory;
|
if (factory.componentType == component) {
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} catch (ex) {
|
||||||
|
return Promise.reject({message: 'Template has some errors and cannot be displayed.', debuginfo: ex});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue