ng2-dynamic-content icon indicating copy to clipboard operation
ng2-dynamic-content copied to clipboard

Runtime compiler is not loaded

Open zarpilla opened this issue 7 years ago • 3 comments

Hi,

When browsing an application (based on angular-cli) compiled for production in Angular 4.0.3:

ng build --env=prod -prod

a runtime error happens when loading a dynamic component (RuntimeContentComponent):

Error: Runtime compiler is not loaded

The same happens when AOT is disabled:

ng build --env=prod -prod -no-aot --aot=false

zarpilla avatar Jul 11 '17 08:07 zarpilla

@zarpilla just verified what declaring a constructor in RuntimeContentComponent class, with compiler as parameter, it comes by injection:

...
export class RuntimeContentComponent {

	private componentRef: ComponentRef <{}>;

	constructor(private compiler: Compiler) {}

	...
}

carrbrpoa avatar Dec 19 '17 13:12 carrbrpoa

Oh, actually it is in the code, just not in his blog.

carrbrpoa avatar Dec 19 '17 13:12 carrbrpoa

This works with aot=false but fails with aot. Any suggestion to get this working with AOT? Thanks.

aldopj avatar Apr 09 '19 23:04 aldopj