Title: Define Angular Custom element without ngModules · Issue #45969 · angular/angular · GitHub
Open Graph Title: Define Angular Custom element without ngModules · Issue #45969 · angular/angular
X Title: Define Angular Custom element without ngModules · Issue #45969 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? elements Description Hello team, So without standalone on to define a custom element as you know we use below syntax: export class AppModule implements DoBootstrap ...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? elements Description Hello team, So without standalone on to define a custom element as you know we use below syntax: export...
X Description: Which @angular/* package(s) are relevant/related to the feature request? elements Description Hello team, So without standalone on to define a custom element as you know we use below syntax: export...
Opengraph URL: https://github.com/angular/angular/issues/45969
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Define Angular Custom element without ngModules","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\nelements\r\n\r\n### Description\r\n\r\nHello team,\r\nSo without standalone on to define a custom element as you know we use below syntax:\r\n```\r\nexport class AppModule implements DoBootstrap {\r\n constructor(private injector: Injector) {}\r\n\r\n public ngDoBootstrap(): void {\r\n const ce = createCustomElement(AppComponent, { injector: this.injector });\r\n customElements.define('likes-app-element', ce);\r\n }\r\n}\r\n```\r\nBut how should we do this without `NgModules`?\r\nI tried to add above snippet to `AppComponent` but seems it does not create custom element and we receive error:\r\n`the selector \"likes-app-root\" did not match any elements.`\r\nI think this is because we already bootstrap AppComponent in main.ts file. With ngModules we could prevent bootstrapping by specifying bootstrap: []. To prevent bootstrapping we could just create custom element in bootstrap.ts but we have to provide Injector there.\r\nThanks.\r\n\r\n### Proposed solution\r\n\r\nI think we should be able to define elements in AppComponent.\r\n\r\n### Alternatives considered\r\n\r\nAlternative was trying to define element in AppComponent but not working as expected.\r\n\r\n### Version\r\nAngular 14.0.0-rc.0\r\nPlaground branch: https://github.com/vugar005/youtube-webapp-turborepo/tree/feature/preview-angular-v14.0.0-rc.0/apps/likes-app","author":{"url":"https://github.com/vugar005","@type":"Person","name":"vugar005"},"datePublished":"2022-05-12T14:21:58Z","url":"https://github.com/angular/angular/issues/45969"}
| 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:39999d82-cecb-d564-c65f-bde235310c47 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D708:ADA9D:E9F467:12F3902:6B00FC3E |
| html-safe-nonce | eba62a4a38d04a11cb5eb2f298b66d483ceea6a32ecd39b2149482fcc8b5d989 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzA4OkFEQTlEOkU5RjQ2NzoxMkYzOTAyOjZCMDBGQzNFIiwidmlzaXRvcl9pZCI6IjYzMjYyOTU4NDc3NjQ2MTM3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c6cf1b11f4ebaa8961a5d962ffaeb13e4211c95fc6dc289890dae357186bdfef |
| hovercard-subject-tag | issue:1234062136 |
| 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/45969/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7f18ed074b907c95741d24270a25e996bf7f7167637f76f3fe4ceba5c0640c9a/angular/angular/issues/45969 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7f18ed074b907c95741d24270a25e996bf7f7167637f76f3fe4ceba5c0640c9a/angular/angular/issues/45969 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? elements Description Hello team, So without standalone on to define a custom element as you know we use below syntax: export... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vugar005 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width