Skip to content

JIT Complier needed with AOT Build for Dynamic Component. #20875

Open

Description

@vijayanandkannan

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I have HTML templates which is loaded from database. It has Form Controls, which I need dynamically render.

Currently in Angular 4.0 it is working fine, but we are not able to update to Angular 5.0 since the feature is not available

Expected behavior

I like to have the JIT Complier supported with AOT build. I am open to other option of displaying the controls.

Minimal reproduction of the problem with instructions

For bug reports please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem via

This is working example with uses the compiler to build.

The top template has the First Name and Last Name.

This container is loaded dynamically with Controls Address, City, Radio options.

http://plnkr.co/edit/rELaWPJ2cDJyCB55deTF?p=preview

For this to work in AOT build I change the Complier to JIT Complier

What is the motivation / use case for changing the behavior?

All our use case are dynamically generated and it comes from Database. All validation are dynamically configured. Love to have the feature back.

Environment


Angular version: Working in Version 4.0.0, not working in Angular 5.0.0


Browser:
- [X ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Activity

  1. vijayanandkannan commented on Dec 8, 2017

    @vijayanandkannan
    Author

    @Toxicable Thanks for the Link.

    I used the link to work on the way I need.

    https://stackblitz.com/edit/angular-dynamic-content-viewer-pfmjl5

    I tried to add they dynamic controls into the content. If you look the First Name is not dynamic, apart from it other controls are dynamic. I need to fire the validation and get the values. Also there are some controls which has dynamic validation fired.

    The Plunkr link that I gave is working fine, but with JIT take out I am having difficulty.

    Here is the link

    http://plnkr.co/edit/rELaWPJ2cDJyCB55deTF?p=preview

    I just need some help and directions, so I can work on some solutions without the need for JIT.

    -Vijay

  2. Torqode commented on Dec 8, 2017

    @Torqode

    The Content Viewer doesn't have a dynamic template. All of the examples are showing how to create components (with static templates) on the fly, or how to dynamically change the pure html content inside a component.

    What's being requested is the ability to create a component at runtime and provide it a template with Angular markup (e.g., {{ someValue | json }}, or <input [(ngModel)]="someValue" formControlName="someCtl">).

  3. Toxicable commented on Dec 8, 2017

    @Toxicable

    @vijayanandkannan Those examples I gave show how you can use static components that are known at build time along with dynamic layouts or content to avoid having to compile anything at runtime.

  4. mlc-mlapis commented on Dec 8, 2017

    @mlc-mlapis
    Contributor

    @Torqode ... you missed the basic principle of Angular concept ... there is no HTML template in run-time because you don't have Angular compiler in run-time so there is nothing what could compile your HTML code which contains Angular bindings.

  5. Torqode commented on Dec 8, 2017

    @Torqode

    @mlc-mlapis Yes, that much is understood. However, in Angular 4 we could include the JIT compiler in with an AOT build which would allow us to do this. But in Angular 5 (even though the JITCompilerFactory has been made public again and JIT compiling the application works), AOT compilation breaks. See #20639.

  6. mlc-mlapis commented on Dec 8, 2017

    @mlc-mlapis
    Contributor

    @Torqode ... I thought that the actual status is as Olivier said ...

    If you want to lazy load a module AoT compiled, you have to compile it with ngc directly, not with ngtools, and then bundle it with rollup, webpack, system js bundler or closure compiler

    #20639 (comment)

    Is it true? ... because I didn't try that yet.

  7. vijayanandkannan commented on Dec 8, 2017

    @vijayanandkannan
    Author

    @Toxicable

    I like to have the feature that was working in angular 4.0. We spent lot of time into this projects and planning to go live, when this was taken out in Angular 5.0.

    What I meant is truly dynamic and we dont know what is coming from the server. All are configured in the server (Including the Valdiation). The plunk example that I gave is a sample of what is being done.

    In angular 4.0 we Implement and create the compiler @ run time (This works perfectly with AOT Build)

    import { JitCompilerFactory } from '@angular/compiler';

    private compiler: Compiler = new JitCompilerFactory([{ useDebug: false, useJit: true }]).createCompiler();

  8. mlc-mlapis commented on Dec 8, 2017

    @mlc-mlapis
    Contributor

    @vijayanandkannan ... did you try what Olivier said and used just ngc with rollup, webpack, system js bundler or closure compiler? I can try that ... I believe that it works ... so you can have AOT + JIT together.

  9. Torqode commented on Dec 8, 2017

    @Torqode

    @mlc-mlapis I use webpack for both AOT and JIT builds, but I'm not sure how to compile just the module that needs the JIT compiler and then bundle it with the rest of the application. Is it possible to have the Angular CLI accept a single module to compile?

  10. mlc-mlapis commented on Dec 8, 2017

    @mlc-mlapis
    Contributor

    @Torqode ... I did a short test using just ngc to compile a sample to AOT app and then load a dynamic module in JIT mode in it. That module was loaded and compiled without any problem and I was able to create and place a new instance of its component. Now I am loading that module via SystemJsNgModuleLoader provider from @angular/core.

    What I'll want to do is to use just a template string of any HTML with Angular bindings for that component ... just to simulate an operation of getting that HTML from CMS server for example.

  11. mlc-mlapis commented on Dec 8, 2017

    @mlc-mlapis
    Contributor

    @Torqode @vijayanandkannan ... I did also the second part with fully dynamic creation of @Component and @NgModule ... just using addDynamicModule method in AppComponent ... here no loader necessary and template argument could be any HTML template:

    public addDynamicModule(template: string): void {
    
    	@Component({
    		template: template,
    	})
    	class TemplateComponent {}
    
    	@NgModule({
    		declarations: [TemplateComponent],
    		imports: [CommonModule]
    	})
    	class TemplateModule {}
    
    	const _ngModuleFactory = this._compiler.compileModuleAndAllComponentsSync(TemplateModule);
    	const _cmpFactory = _ngModuleFactory.componentFactories.find((_componentFactory) =>
    		_componentFactory.componentType === TemplateComponent
    	);
    	const _cmpRef = this.vc.createComponent(_cmpFactory);
    }
    

    So everything is working ... AOT & JIT together. This is good info about Angular API. Another thing is using this with Angular CLI. Using directly Rollup, Webpack, SystemJS bundlers or Closure Compiler should be fine.

  12. added
    area: core
    on Dec 9, 2017
  13. vijayanandkannan commented on Dec 9, 2017

    @vijayanandkannan
    Author

    @mlc-mlapis Thanks for the Info. Are you using JITComplierFactory to create the complier or you are using the complier itself.

    I am not to much familar with the Compliing part can you give me some steps of what you have done, so it will easy to work with

    Example

    Have you complied the entire module with ngc. Any optional parameters?

    Also other steps that you have done.....

    Thanks

    Vijay

  14. mlc-mlapis commented on Dec 9, 2017

    @mlc-mlapis
    Contributor

    @vijayanandkannan ... I used the same as Olivier showed ... so providers:

    {
    	provide: COMPILER_OPTIONS,
    	useValue: {},
    	multi: true
    },
    {
    	provide: CompilerFactory,
    	useClass: JitCompilerFactory,
    	deps: [COMPILER_OPTIONS]
    },
    {
    	provide: Compiler,
    	useFactory: createCompiler,
    	deps: [CompilerFactory]
    },
    

    and export function:

    export function createCompiler(fn: CompilerFactory): Compiler {
    	return fn.createCompiler();
    }
    

    on the main app module level and compiler injected through DI:

    constructor(private _compiler: Compiler, ...) {}
    

    and then using the function addDynamicModule as showed above on a component level. That's all. Compilation just via ngc. I used directly the compiled files in AOT mode platformBrowser().bootstrapModuleFactory(AppModuleNgFactory), so that's why I didn't have to optimize them ... tree-shaking and so on ... so I used "compilerOptions": {"target": "es5", "module": "commonjs", ...}.

    tsconfig.json

    {
    	"compilerOptions": {
    		"target": "es5",
    		"module": "commonjs",
    		"declaration": true
    		"moduleResolution": "node",
    		"sourceMap": false,
    		"allowUnreachableCode": false,
    		"outDir": ".",
    		"allowSyntheticDefaultImports": true,
    		"emitDecoratorMetadata": true,
    		"experimentalDecorators": true,
    		"stripInternal": true,
    		"pretty": true,
    		"removeComments": true,
    		"strictNullChecks": false,
    		"noImplicitAny": false,
    		"noUnusedParameters": false,
    		"noUnusedLocals": false,
    		"skipLibCheck": true,
    		"lib": ["es5", "es2015", "dom"],
    		"typeRoots": ["./node_modules/@types"]
    	},
    	"angularCompilerOptions": {
    		"skipTemplateCodegen": false,
    		"annotationsAs": "static fields",
    		"skipMetadataEmit": false
    	},
    	"include": [
    		"./app/**/*.ts"
    	],
    	"exclude": [
    		"node_modules",
    		"./app/**/*.spec.ts"
    	]
    }
    
  15. 41 remaining items

  16. agrinko commented on Feb 22, 2020

    @agrinko

    @MeeranRM , indeed, everything is much simpler now with Ivy.
    This article helped me to successfully upgrade my plugin architecture to Angular 9: https://medium.com/angular-in-depth/asynchronous-modules-and-components-in-angular-ivy-1c1d79d45bd3

    You don't need to override builder logic anymore to achieve dynamic plugins architecture: you only need custom builders in order to use webpack externals (to avoid bundling angular core and other libraries with the plugin code). I used ngx-build-plus with a custom webpack configfor this. Although I'm not sure it's necessary now. Maybe using ng-packagr would be sufficient for that.

    You don't need any hooks to work with ng module factories - there are no module factories anymore! I just used that piece of code from the article to inject dynamically loaded external module to the main app:

        import('./carousel/carousel.module').then(({ CarouselModule }) => {
          // this is the only use of Ivy's private API: createInjector function is not public yet, but hopeful it's just the questions of time
          const injector = createInjector(CarouselModule, this.injector);
          const carouselModule = injector.get(CarouselModule);
          const componentFactory = carouselModule.resolveCarouselComponentFactory();
          const componentRef = this.carousel.createComponent(componentFactory);
          componentRef.changeDetectorRef.markForCheck();
        });

    Just instead of import I used SystemJS v0.21.6 to be able to inject external dependencies for the webpack.

    In summary, JIT compilation is probably not needed anymore at all. Ivy uses AOT by default, and it enables truly dynamic architecture.
    Lmk if you have more specific questions.

  17. MeeranRM commented on Feb 25, 2020

    @MeeranRM

    @agrinko thanks for ur reply. I understand your point. My requirement is to use the JIT compiler with the AOT build is to render the dynamic template at runtime.

    My scenario:

    I'm using ngx-dynamic module. please check this out for reference.

    I used this below technique from that module to make the HTML string (which is fetched from the server) compiled dynamically. This code only worked with the help of the JIT compiler. It won't work in the AOT build.

    @Component({
      selector: 'dynamic-cmp-demo',
      template: `
        <div *dynamicComponent="template; context: {text: text};"></div>
      `,
    })
    export class DynamicCmpDemoComponent {
      template = `
      <article>
        <h1>Awesome Document</h1>
        <div>
          <p>{{text}}</p>
          <my-button></my-button>
        </div>
      </article>
      `;
     
      text = 'foo';
    }
    

    So, could you please advise how to implement this scenario in angular ivy? or any other solution is appreciated

  18. mlc-mlapis commented on Feb 25, 2020

    @mlc-mlapis
    Contributor

    @MeeranRM The first thing is to be sure that your idea of dynamic compilation of external HTML is really necessary. In most of the cases, I saw before the main problem was that people were simply used to use this historical concept without re-thinking why and if they need it at all.

    Generally, it's simply the way which is very problematic either with testing (you never know what comes as a template), performance and the final stability of such apps.

  19. agrinko commented on Feb 25, 2020

    @agrinko

    @MeeranRM not sure I understand your use-case. If you have some angular templates on the server and want to render them into your application, then it is the same as I did. But I do compile the components in a module using AOT to a single JS file and then inject it to the main app. I didn't even consider loading templates as pure strings because I need not only templates, but also styles and related TypeScript code.

  20. snoop088 commented on May 17, 2020

    @snoop088

    Hi @agrinko @MeeranRM
    This is an excellent discussion. I am faced with a very similar questions.
    But first, the use case - it is quite trivial I think - not sure why it has not come up or at least I cannot find any good solutions when using AOT post Angular 5. Imagine a simple CMS, where you can have a library of prebuilt components, but then you can extend them with hundreds of new templates that are built through some web UI and saved on the fly. The components can then be loaded on demand with selected template, should be able to leverage data from elsewhere in your angular application, reuse other components that you have exported, etc.
    So when reading a ton of articles to find a good dynamic solution I bumped into this

    import('./carousel/carousel.module').then(({ CarouselModule }) => {...

    but this is not truly dynamic? You do have a hardcoded static import string. What if you have 100 components from which you would like to build a dashboard?? How do you use the above import - surely not a switch-case? I think this type of static import is just a very specific use case, whereas the generic case would be that the component name is loaded from somwhere async.

    Even if you are able to do some trickery like this:

    private createComponentFromModule(name: string, path: string) {
        import(`../../../../${path}/${name}.module`).then(cmp => {
          const cap = name.substr(0, 1).toLocaleUpperCase() + name.substr(1);
          const dynaModule: DynaModule<any> = createInjector(cmp[cap + 'Module'], this.injector).get(cmp[cap + 'Module']);
          const factory = dynaModule.resolveDynaComponentFactory();
          const compRef = this.viewContainer.createComponent(factory);
          this.compileFromFactory(dynaModule);
        });
      }
    

    which is far from great I admit.
    Then you could try compiling on the fly to replace a template with one that you load from a db:

    private compileFromFactory(dynaModule: DynaModule<any>) {
        const dynaComponentClass = Component({
          template: '<p>this is my loaded template here using interpolation to load a value from the controller</p>{{ fromCmp }}',
          styles: ['p { color: red }'] // should also be loaded from db
        })(class Comp extends dynaModule.resolveDynaComponentFactory().componentType { }) // inherit the logic from a component
        const dynaComponentModule = NgModule({ declarations: [dynaComponentClass] })(class {
        }); // include in a module and compile it on the fly
        this.compiler.compileModuleAndAllComponentsAsync(dynaComponentModule)
        .then((factories) => {
          const f = factories.componentFactories[0];
          const cmpRef = this.viewCompiled.createComponent(f);
        })
    
      }
    

    My idea is to reuse logic but be able to inject a template on the fly without the need to rebuild the whole app.
    I tried this by injecting the JIT compiler, which in itself was a pain. It worked with aot=false (ng serve), it compiled with aot=true for production with optimisation, but then when running it it threw an error in the browser console..!?!
    So @agrinko , I was wondering how did you manage to compile the components/ module with AOT and then inject it to the main app, which you mention above. I assume doing this did not need the app to be rebuilt? That could potentially be very useful in my use case even if it will require a certain server side step to invoke a built process when a user updates a template via the UI.. Is there any code example that is relevant to Ivy that you could point me to? I only found this on the web:
    https://medium.com/angular-in-depth/building-extensible-dynamic-pluggable-enterprise-application-with-angular-aed8979faba5 but it uses custom webpack build scripts and I would much more prefer to build my components using angular-cli libraries.. Also the above seems to refer to Angular 8, not Ivy.
    Sorry if my coding snippeds are not perfect, I am really not a good JS coder..
    any pointers would be very very appreciated :)
    thanks!
    Nick

  21. agrinko commented on May 27, 2020

    @agrinko

    Hi @snoop088 .
    Yes, you have exactly the same use-case as I do. Three Angular projects: Web, Mobile (with Ionic) and "web-templates" library, which includes such templates of the components. Whenever somebody changes/creates a new template, they only need to rebuild web-templates library, which is quick (and which can be handled automatically). The idea is to provide a UI for editing such templates later. And the new set of components is loaded to the main app via HTTP request after refreshing it. Although I don't load each component separately - I bundle them all in one module instead.

    I even had an idea to write an article about it, though I'm too lazy busy for that now.
    Here are the key aspects of my solution, and if you still need some help, let's contact, and I can explain more. Perhaps not the most elegant solution, but that's what we have with current Angular framework...

    I. The instruction for the web-templates lib:
    0. Solutions for Angular 7/8 and for Angular 9 are very different. Initially, I implemented for Angular 7, and it was very tricky. Now it's much simpler, although not without some tricks.

    1. The components module is configured as an Angular library using ngx-build-plus:browser builder, which you have to install separately to avoid including @angular/core and other dependencies to the final JS bundle:
    "web-templates": {
          "projectType": "library",
          "root": "libs/web-templates",
          "sourceRoot": "libs/web-templates/src",
          "prefix": "wt",
          "architect": {
            "build": {
              "builder": "ngx-build-plus:browser",
              "options": {
                "outputPath": "dist/libs/web-templates",
                "index": "libs/web-templates/src/index.html",
                "main": "libs/web-templates/src/main.ts",
                "tsConfig": "libs/web-templates/tsconfig.lib.json",
                "aot": true,
                "vendorChunk": false,
                "extractCss": true,
                "namedChunks": false,
                "assets": [],
                "styles": [],
                "scripts": []
              }
          }
        }
    }
    1. The build command looks like this: ng build --extra-webpack-config libs/web-templates/extra-webpack.config.js --project web-templates --single-bundle
    2. The file libs/web-templates/extra-webpack.config.js contains this:
    module.exports = {
      output: {
        libraryTarget: 'umd' // wrap the output in the UMD to make it consumable by the host apps (using SystemJS)
      },
     // the property name is how the dependency is referred to from the web-templates, the value - how it is provided by the main app; in my case they're all the same
      externals: [{
        "rxjs": "rxjs",
        "rxjs/operators": "rxjs/operators",
        "@angular/core": "@angular/core",
        "@angular/common": "@angular/common",
        "@angular/forms": "@angular/forms",
        "@angular/platform-browser": "@angular/platform-browser",
        "lodash": "lodash",
        "moment": "moment",
        // and all other dependencies you want to externalize
      }]
    };
    1. The file libs/web-templates/src/index.html is just a blank HTML document; it's there just because Angular requires it; but we don't need it.
    2. The file libs/web-templates/src/main.ts just re-exports the main module that shall be consumed by the host application. The host application should know its name:
    import { WebTemplatesModule } from './lib/web-templates.module';
    
    export {
      WebTemplatesModule
    }
    1. The file libs/web-templates/src/lib/web-templates.module.ts looks like this:
    import { ComponentFactory, ComponentFactoryResolver, NgModule } from '@angular/core';
    // ...many other imports
    
    @NgModule({
      // I don't remember why, but I guess it doesn't work if you don't bootstrap the exported component
      bootstrap: [TemplateComponent],
      declarations: [
        TemplateComponent,
        // ...and many others
      ],
      providers: [
        // ...
      ],
      imports: [
        // ...
      ],
      exports: [
        TemplateComponent
      ]
    })
    export class WebTemplatesModule {
      constructor(private resolver: ComponentFactoryResolver) {}
    
      // this method is later called by the host application to resolve the root component
      public resolveTemplateComponentFactory(): ComponentFactory<TemplateComponent> {
        return this.resolver.resolveComponentFactory(TemplateComponent);
      }
    }
    1. Finally, I have the root component - libs/web-templates/src/lib/template/template.component.html, which receives the inputs from the host application, and decides which exact component to render based on those inputs, using... yes, using ngSwitchCase 😅 I belive there is a better solution if you have hundreds of components. You could organize them in separate modules, each with its own bundle JS, or export them from the main module. But for me it was fine. At least the host application doesn't care how the actual component is resolved.

    II. The instruction for the host application:
    0. Install SystemJS as a dependency. For some reason, it only worked for me with this old version of SystemJS, not with any newer version: "systemjs": "0.21.6"

    1. I have a special web-templates.service which takes care of loading the external web-templates module, providing dependencies for it, etc. The file is too big, so you can see it here (ignore the rest, that sample isn't working): https://codesandbox.io/s/jolly-thunder-kqufn?file=/web-templates.service.ts
    2. From my ApplicationComponent::ngOnInit I call it like this.webTemplatesService.resolve().subscribe(...) and hope to get the external module to be injected into my app
    3. I have a proxy component in the host app, which uses that service to inject the external component into itself, or show error in case it cannot. Its template is blank (just renders error messages if needed, or shows launcher during the load). The component is injected like this:
      async ngAfterViewInit() {
        try {
          // if module is not ready yet, wait for it before injecting a component
          if (!this.webTemplatesService.resolved)
            await this.webTemplatesService.resolve().toPromise();
    
          this.loading = false;
          this.templateRef = this.webTemplatesService.injectTemplate(this.viewContainerRef, {
            body: this.message.body,
            resize$: this.resize$,
            config: this.getTemplateConfig()
          }, {
            action: a => this.onAction(a),
            update: () => this.update.emit(),
            ready: (info: ITemplateInfo) => this.ready.emit(info)
          });
          this.cdRef.detectChanges();
        } catch (e) {
          console.error(e);
    
          this.loading = false;
          this.error = true;
          this.cdRef.detectChanges();
    
          // attempt injecting again, if the module will be ready at some point in the future
          this.webTemplatesService.ready$.subscribe(() => this.injectComponent());
        }
      }

    This is just a rough explanation. If it really can be useful for somebody, I could prepare some better samples in the codesandbox.

    P.S: Most of this implementation was inspired by this article: https://medium.com/angular-in-depth/asynchronous-modules-and-components-in-angular-ivy-1c1d79d45bd3
    P.P.S: do you think I should provide this solution as a public library (at least for the web-templates.service part) and/or a sample repo?

  22. snoop088 commented on May 28, 2020

    @snoop088

    Hi @agrinko
    thanks a lot for all the time taken to reply! It is a quite bit to read (seems there is no 4-5 line solution to this :))
    I am starting on it and I will get back here with feedback once I get to the bottom of it. I have also read the above article that you mention few times. My problem is that whenever I try to import a compiled library, I always get 'Module not found' error in the console. However, I have used only import() as mentioned in the above article or "systemjs": "3.1.6". I have not tried with an older version and I have also compiled the library with the standard Angular 9 cli which is using ng-packagr because it was easier for testing, but is probably wrong. I will try ngx-build-plus:browser that you suggest next because of the externals handling. I tried importing the umd bundles from the built lib, but again I get 'Moduled not found'. I suspect that the issue is from the fact that import() and systemjs look into some path mappings to look for the module and do not load an arbitrary path which I am trying to load. My idea being to be able to put built libraries in some path without rebuilding the app.
    I think a public github with a part of the project showing just the loading of the built library/ module would be great! To be honest I am still quite lost in this and I have resolved into importing the Angular Compiler at bootstrap as suggested here: https://www.angulararchitects.io/aktuelles/architecture-with-angular-ivy-part-2-higher-order-and-dynamic-components/ as it is by far the simplest solution I could find, but it causes bigger app bundle by around 300kb+ which is not negligible. Also it kind of does not go inline with the AOT idea as you compile on the fly and not ahead of time :))
    anyway, thanks for your help, it is appreaciated. I will go over it in the next few days as I need to start making some decisions how to migrate our frontend from angular 5 using JIT to angular 9..10..n and AOT.
    Nick

  23. snoop088 commented on Jun 11, 2020

    @snoop088

    Hi @agrinko
    thanks again for your help here. I made it work :)
    I am using nx.dev monorepo structure with buildable libraries. I have managed to implement a library that once built via ng-packgr for ivy can then be injected in the main app via SystemJS 0.21.6, which you correctly pointed out. Newer SystemJS may have switched to ES6 modules while this version works well with the umd bundles that ng-packgr builds. All is well so far and I can move on to the next stage of the software architecture design :). Hoping it will go smoother than this AOT injecting stuff hehe
    again thanks for all your help. Happy to share more details if anyone is interested.
    cheers,
    Nick

  24. pcatuna commented on Dec 3, 2020

    @pcatuna

    @snoop088 could you please share some details about your implementation ?

  25. snoop088 commented on Dec 9, 2020

    @snoop088

    Hi @pcatuna
    I would be happy to share a little more detail. However, there is this thing that is currently pestering me in the approach that I have taken. It is using a library that is no longer maintained. "systemjs": "0.21.6" This is also what Alexey also mentioned above. It could be problematic if the next angular module import does not work with this library. This is why we didnt get this in production yet and we are still searching to possibly replace the systemjs with a later version that is being supported.

    I prefer to spend some more time on this and possibly share something that would be a little more future proof instead.. Hopefully I find something before switching to react at the end :) It seems to be much more open with dynamic 'on-the-fly' component rendering than angular.
    cheers!
    Nick

  26. hadrien-toma commented on Dec 9, 2020

    @hadrien-toma
    Contributor

    I take the opportunity to report than in Vue.js also it is much more open than in Angular for on the fly component creation/use. There even already exists a library for that: https://github.com/alexjoverm/v-runtime-template

  27. added
    feature: under consideration
    on Jun 4, 2021
  28. added
    area: compiler
    on May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerarea: corecompiler: jitfeaturefeature: under consideration

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions