简体   繁体   English

角度aot项目+ jit

[英]angular aot project + jit

Is there an 'officcial' way in angular 7/8 to have a classic AOT app lazy load components BUT having those components not precompiled? 在Angle 7/8中是否有“官方”方式让经典的AOT应用程序延迟加载组件BUT,但这些组件没有预编译?

My scenario is an enterprise app where users can 'design' html+ts forms on the fly. 我的情况是一个企业应用程序,用户可以在其中“动态”设计html + ts表单。 These forms are stored as plain html and ts files , so angular should be able to discover them (based on a service), register their new routes, load the ts+html, compile in browser and run. 这些格式存储为纯HTML和ts文件 ,因此angular应该能够发现它们(基于服务),注册它们的新路径,加载ts + html,在浏览器中编译并运行。

Why this question is not a duplicate: I dont see any info on having an AOT app consume new components that were just created as html+ts (not compiled). 为什么这个问题不是重复的:我没有看到有关使用AOT应用程序消耗新创建为html + ts(未编译)的新组件的任何信息。

ANY help is appreciated 任何帮助表示赞赏

I don't think so. 我不这么认为。 Have you read this blog post? 您读过这篇博客文章吗? https://blog.angularindepth.com/here-is-what-you-need-to-know-about-dynamic-components-in-angular-ac1e96167f9e https://blog.angularindepth.com/here-is-what-you-need-to-know-about-dynamic-components-in-angular-ac1e96167f9e

One thing mentioned in that post is that non-AOT compilation is frowned upon: 那篇文章中提到的一件事是非AOT编译被皱眉:

Keep in mind that this approach makes use of a compiler which is not supported as a Public API. 请记住,这种方法使用了不支持作为公共API的编译器。 Here is what the docs say: 这是文档所说的:

One intentional omission from this list is @angular/compiler, which is currently considered a low level api and is subject to internal changes. 此列表中的一个有意遗漏的是@ angular / compiler,它目前被认为是低级api,并且可能会进行内部更改。 These changes will not affect any applications or libraries using the higher-level apis (the command line interface or JIT compilation via @angular/platform-browser-dynamic). 这些更改不会影响使用更高级别的api(命令行界面或通过@ angular / platform-b​​rowser-dynamic进行的JIT编译)的任何应用程序或库。 Only very specific use-cases require direct access to the compiler API (mostly tooling integration for IDEs, linters, etc). 只有非常特定的用例才需要直接访问编译器API(主要是IDE,lint等的工具集成)。 If you are working on this kind of integration, please reach out to us first. 如果您正在从事这种集成,请首先与我们联系。

I suspect it would be easier to compile the component with a service as the user modifies the HTML / TS and then show a 'preview', kind of like Overleaf showing a preview of compiled latex. 我怀疑当用户修改HTML / TS并显示“预览”时,使用服务编译组件会更容易,就像Overleaf一样,显示已编译的乳胶预览。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM