Title: Story: Multiple independent Apps on same Page for CMS Content Extensions · Issue #16930 · angular/angular · GitHub
Open Graph Title: Story: Multiple independent Apps on same Page for CMS Content Extensions · Issue #16930 · angular/angular
X Title: Story: Multiple independent Apps on same Page for CMS Content Extensions · Issue #16930 · angular/angular
Description: I'm submitting a ... (check one with "x") [x] feature request Story / Current behavior Based on what I understand ATM, a production grade Angular 4 App will create a few compact JS files which work together, but assume that they are the ...
Open Graph Description: I'm submitting a ... (check one with "x") [x] feature request Story / Current behavior Based on what I understand ATM, a production grade Angular 4 App will create a few compact JS files which work...
X Description: I'm submitting a ... (check one with "x") [x] feature request Story / Current behavior Based on what I understand ATM, a production grade Angular 4 App will create a few compact JS fi...
Opengraph URL: https://github.com/angular/angular/issues/16930
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Story: Multiple independent Apps on same Page for CMS Content Extensions","articleBody":"**I'm submitting a ...** (check one with \"x\")\r\n```\r\n[x] feature request\r\n```\r\n\r\n**Story / Current behavior**\r\nBased on what I understand ATM, a production grade Angular 4 App will create a few compact JS files which work together, but assume that they are the only Angular stuff on the existing HTML page. This prevents using Angular in a lot of important CMS use cases, which require adding multiple standalone parts to a page. It also causes a lot of trouble when needing to inject instance-specific initialization values (like an instance ID needed to talk to the server APIs). \r\n\r\nIn Angular 1 it was possible to work around this limitation by loading the partial libraries one-by-one (so that the CMS could ensure certain libraries were only loaded once) and by creating a custom bootstrapper, which would inject initialization values for each instance of the app. In Angular 4, this seems impossible or extremely difficult. \r\n\r\n**Expected behavior**\r\nMany CMSs allow content-editors to add multiple parts to a page - for example a gallery + an interactive graphic + a contact form and some content. Many of these parts will be JS based as in the example of the touch-gallery and the contact form. To function properly, these parts should be\r\n\r\n1. autonomous, so that adding one doesn't require the other\r\n2. side-effect free, so that adding the second doesn't break the first\r\n\r\nIn addition to this, the same app could be inserted multiple times (imagine some text + a gallery + some more text + more galleries). So both of these scenarios must work:\r\n1. multiple instances of the same app\r\n2. various instances of different apps\r\n\r\nFor this to work properly, each app must be fed with initialization parameters like an instance-id, which must be provided by the surrounding HTML around the `\u003capp-something>` tag and/or by a custom JS bootstrapper, which can say _bootstrap the first app-something with these values, the second with these_. \r\n\r\nIt would also be beneficial if certain optimizations could easily prevent loading certain libraries multiple times, but this is of much lower priority. \r\n\r\n**Minimal reproduction of the problem with instructions**\r\nIt's very hard to provide a running example, but basically just try to add two different Angular apps to the same page, and you'll be met by a plethora of errors - for example because some Angular parts complain about pre-existing initialization etc. \r\n\r\nIn Addition I've tried many ways to inject external parameters, but all the methods I found rely on cluttering the `window` variable or other global mechanisms, which doesn't work when you have different values for each instance. I have also not found a way to access the initial tag (it could contain initialization values), as it's not available at the moment the app is being built, especially not during the APP_INITIALIZER. \r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nVery important use case in many CMS-component scenarios. \r\nNote that we're explicitly talking about components which run in the CMS output, not admin UIs. Admin-UIs could in some ways sync the development to somehow be compatible and work out the complex dependencies (but it would be nasty), whereas output-components are impossible to coordinate, as they are made by separate teams. \r\n\r\n**Please tell us about your environment:**\r\nIn my case I'm developing for [2sxc](https://2sxc.org/) a CMS built with [DNN](https://github.com/dnnsoftware/Dnn.Platform). \r\n\r\n* **Angular version:** 4.0.X\r\n\r\n* **Browser:** all / not applicable\r\n \r\n* **Language:** all using CLI / both normal build and prod","author":{"url":"https://github.com/iJungleboy","@type":"Person","name":"iJungleboy"},"datePublished":"2017-05-22T18:48:16Z","url":"https://github.com/angular/angular/issues/16930"}
| 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:67560ab3-b319-e0f7-37f4-983bf14c0afd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDFE:25598F:DA8992:121CF25:6B00FD8A |
| html-safe-nonce | 369dee8431611ac9ac5ead2635c7a12ef74b91d09f52bc703af3d268f7136172 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREZFOjI1NTk4RjpEQTg5OTI6MTIxQ0YyNTo2QjAwRkQ4QSIsInZpc2l0b3JfaWQiOiI2NjY0NzY5NTI1NDYxODc2MTA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b5703a5377e7e54da0989e3c95d795c8b3950c230406fe8d9085ebc738491227 |
| hovercard-subject-tag | issue:230484782 |
| 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/16930/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4c38cbd2343be27de900d0a93c0cd241ce24049aa58b42778baa2915cf4d3f7e/angular/angular/issues/16930 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4c38cbd2343be27de900d0a93c0cd241ce24049aa58b42778baa2915cf4d3f7e/angular/angular/issues/16930 |
| og:image:alt | I'm submitting a ... (check one with "x") [x] feature request Story / Current behavior Based on what I understand ATM, a production grade Angular 4 App will create a few compact JS files which work... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iJungleboy |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width