Title: JIT compiler and dynamic template component issue after angular 13 upgrade · Issue #22570 · angular/angular-cli · GitHub
Open Graph Title: JIT compiler and dynamic template component issue after angular 13 upgrade · Issue #22570 · angular/angular-cli
X Title: JIT compiler and dynamic template component issue after angular 13 upgrade · Issue #22570 · angular/angular-cli
Description: Which @angular/* package(s) are the source of the bug? common, compiler, core Is this a regression? Yes Description Due to business reasons, we need to have the ability of loading and executing angular code dynamically in the application...
Open Graph Description: Which @angular/* package(s) are the source of the bug? common, compiler, core Is this a regression? Yes Description Due to business reasons, we need to have the ability of loading and executing ang...
X Description: Which @angular/* package(s) are the source of the bug? common, compiler, core Is this a regression? Yes Description Due to business reasons, we need to have the ability of loading and executing ang...
Opengraph URL: https://github.com/angular/angular-cli/issues/22570
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JIT compiler and dynamic template component issue after angular 13 upgrade","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncommon, compiler, core\n\n### Is this a regression?\n\nYes\n\n### Description\n\nDue to business reasons, we need to have the ability of loading and executing angular code dynamically in the application, the dynamic component template comes from an API call.\r\n\r\nAfter upgrading from angular 12 to angular 13 our implemented solution for dynamic components is no longer working. Updating our codebase to avoid using the deprecated ViewEngine didn't help, we get the same errors.\r\n\r\nCan't get my head around specially as to why things like the ngIf directive is not recognized anymore.\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n```true\nNG0304: 'swiper' is not a known element:\r\n1. If 'swiper' is an Angular component, then verify that it is part of this module.\r\n2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.\r\ncore.mjs:10119 NG0303: Can't bind to 'autoplay' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'effect' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'grabCursor' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'loop' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'pagination' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'slidesPerView' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'spaceBetween' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'speed' since it isn't a known property of 'swiper'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'null'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'null'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'p'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'p'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'a'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'a'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'a'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'a'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\r\ncore.mjs:10119 NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'.\n```\n\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI: 13.1.4\r\nNode: 12.22.5\r\nPackage Manager: npm 6.14.14\r\nOS: win32 x64\r\n\r\nAngular: 13.1.3\r\n... animations, cdk, common, compiler, compiler-cli, core, forms\r\n... language-service, material, platform-browser\r\n... platform-browser-dynamic, platform-server, router\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1301.4\r\n@angular-devkit/build-angular 13.1.4\r\n@angular-devkit/core 13.1.4\r\n@angular-devkit/schematics 12.0.4\r\n@angular/cli 13.1.4\r\n@angular/google-maps 12.2.13\r\n@nguniversal/builders 13.0.2\r\n@nguniversal/express-engine 12.1.3\r\n@schematics/angular 12.0.4\r\nrxjs 6.6.7\r\ntypescript 4.5.5\n```\n\n\n### Anything else?\n\nThis is esentially how we're doing the whole process after the ViewEngine deprecation:\r\n\r\n createDynamicComponent() {\r\n const component = this.createComponent();\r\n const module = this.createModule(component);\r\n this.componentRef = this.container.createComponent(component, { ngModuleRef: module });\r\n }\r\n \r\n createComponent(): Type\u003cany> {\r\n const self = this;\r\n const metadata = new Component({\r\n selector: 'dynamic',\r\n template: this.template,\r\n });\r\n const componentClass = class DynamicComponent implements OnInit, OnDestroy {\r\n constructor() {\r\n SwiperCore.use([Autoplay, Pagination]);\r\n }\r\n \r\n ngOnInit() {}\r\n \r\n ngOnDestroy() {}\r\n };\r\n \r\n // Class constructor parameters\r\n (componentClass as any).ctorParameters = () => [];\r\n \r\n return Component(metadata)(componentClass);\r\n }\r\n \r\n createModule(decoratedComponent: Type\u003cany>): NgModuleRef\u003cany> {\r\n const moduleClass = class RuntimeComponentModule {};\r\n const decoratedNgModule = NgModule({\r\n imports: [CommonModule, RouterModule, SharedModule],\r\n jit: true,\r\n declarations: [decoratedComponent],\r\n })(moduleClass);\r\n \r\n return createNgModuleRef(decoratedNgModule, this.injector);\r\n }\r\n\r\nHere the SharedModule exports common things like SwiperModule, Material modules and so on.","author":{"url":"https://github.com/manuelbve","@type":"Person","name":"manuelbve"},"datePublished":"2022-01-25T09:30:57Z","url":"https://github.com/angular/angular-cli/issues/22570"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e728e6b8-5418-78bd-1f3b-2e25b96f6705 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D980:14ECB:10D021C:15619C3:6B011649 |
| html-safe-nonce | e642e445db0aef12dfc2515401c2816e5bc3544a0b62ee0f3cb876a68636f59b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTgwOjE0RUNCOjEwRDAyMUM6MTU2MTlDMzo2QjAxMTY0OSIsInZpc2l0b3JfaWQiOiI2NDk5ODIyNTgyMDY0Mjg5MzUzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 13018b2b42470c9a15956d4e9ebdb89dbe96c584c11208bc858c5e3606cbd73f |
| hovercard-subject-tag | issue:1113779103 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/22570/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e51e77082e9e1ea995a2dd40cf5e48af1a2a3fad87bc355717a21d69c0304ad9/angular/angular-cli/issues/22570 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e51e77082e9e1ea995a2dd40cf5e48af1a2a3fad87bc355717a21d69c0304ad9/angular/angular-cli/issues/22570 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? common, compiler, core Is this a regression? Yes Description Due to business reasons, we need to have the ability of loading and executing ang... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | manuelbve |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width