René's URL Explorer Experiment


Title: Angular Element issue with change detection running on Property value change · Issue #31055 · angular/angular · GitHub

Open Graph Title: Angular Element issue with change detection running on Property value change · Issue #31055 · angular/angular

X Title: Angular Element issue with change detection running on Property value change · Issue #31055 · angular/angular

Description: 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? Unknown Description In an Angular Element hosted by a JQuery project, if JQuery tries to set the value of a property defined with the @i...

Open Graph Description: 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? Unknown Description In an Angular Element hosted by a JQuery project, if JQuery tries to set the...

X Description: 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? Unknown Description In an Angular Element hosted by a JQuery project, if JQuery tries to set the...

Opengraph URL: https://github.com/angular/angular/issues/31055

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular Element issue with change detection running on Property value change","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\nThe issue is caused by package @angular/elements\r\n\r\n### Is this a regression?\r\nUnknown\r\n\r\n### Description\r\nIn an Angular Element hosted by a JQuery project, if JQuery tries to set the value of a property defined with the @Input() decorator, the Angular Element does not see the value change.\r\n\r\n## 🔬 Minimal Reproduction\r\nSteps for a minimal reproduction:\r\n1. `ng new PropBindingTest` (No Routing, Use CSS)\r\n2. `cd PropBindingTest`\r\n3. `ng add @angular/elements`\r\n4. `ng add ngx-build-plus`\r\n5. Change app.module.ts\r\n```\r\nimport { Injector, NgModule } from '@angular/core';\r\n\r\nimport { AppComponent } from './app.component';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\nimport { createCustomElement } from '@angular/elements';\r\n\r\n@NgModule({\r\n  declarations: [\r\n    AppComponent\r\n  ],\r\n  imports: [\r\n    BrowserModule\r\n  ],\r\n  entryComponents: [\r\n    AppComponent\r\n  ]\r\n})\r\nexport class AppModule {\r\n  constructor(private injector: Injector) {\r\n  }\r\n\r\n  ngDoBootstrap() {\r\n    const customEl = createCustomElement(AppComponent, { injector: this.injector });\r\n    customElements.define('prop-binding-test', customEl);\r\n  }\r\n}\r\n```\r\n\r\n6. Change app.component.ts\r\n```\r\nimport { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\r\n\r\n@Component({\r\n  templateUrl: './app.component.html',\r\n  styleUrls: ['./app.component.css']\r\n})\r\nexport class AppComponent implements OnInit, OnChanges {\r\n  @Input() public testProp: { header: string, paragraph: string };\r\n\r\n  public ngOnInit(): void {\r\n    console.log('ngOnInit Fired.', this.testProp);\r\n  }\r\n\r\n  public ngOnChanges(changes: SimpleChanges): void {\r\n    console.log('ngOnChanges Fired.', changes, this.testProp);\r\n  }\r\n}\r\n```\r\n\r\n7. Change app.component.html\r\n```\r\n\u003ch1 *ngIf=\"testProp\">{{testProp.header}}\u003c/h1>\r\n\u003cp *ngIf=\"testProp\">{{testProp.paragraph}}\u003c/p>\r\n```\r\n\r\n8. Remove `import 'zone.js/dist/zone';` from polyfills.ts, final polyfills.ts should be empty\r\n9. Add `import 'zone.js';` to top of main.ts, final main.ts should be\r\n```\r\nimport 'zone.js';\r\n\r\nimport { AppModule } from './app/app.module';\r\nimport { enableProdMode } from '@angular/core';\r\nimport { environment } from './environments/environment';\r\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\r\n\r\nif (environment.production) {\r\n  enableProdMode();\r\n}\r\n\r\nplatformBrowserDynamic().bootstrapModule(AppModule)\r\n  .catch(err => console.error(err));\r\n```\r\n\r\n10. Change tsconfig.json target from 'es5' to 'es2015', final tsconfig.json should look like\r\n```\r\n{\r\n  \"compileOnSave\": false,\r\n  \"compilerOptions\": {\r\n    \"baseUrl\": \"./\",\r\n    \"outDir\": \"./dist/out-tsc\",\r\n    \"sourceMap\": true,\r\n    \"declaration\": false,\r\n    \"module\": \"es2015\",\r\n    \"moduleResolution\": \"node\",\r\n    \"emitDecoratorMetadata\": true,\r\n    \"experimentalDecorators\": true,\r\n    \"importHelpers\": true,\r\n    \"target\": \"es2015\",\r\n    \"typeRoots\": [\r\n      \"node_modules/@types\"\r\n    ],\r\n    \"lib\": [\r\n      \"es2018\",\r\n      \"dom\"\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\n11. `ng build --prod --single-bundle` (the single-bundle option comes from ngx-build-plus)\r\n12. Copy & Paste PropBindingTest/dist/PropBindingTest/main.d80c1f431a277f0798b0.js into a jQuery project folder\r\n13. In JQuery application, add the following\r\n```\r\n    jQuery('head').append('\u003cscript src=\"../assets/main.d80c1f431a277f0798b0.js\">\u003c/script>');\r\n    const propTest = document.createElement(\"prop-binding-test\");\r\n    jQuery('#some_location').after(propTest);\r\n    propTest.testProp = { header: \"I Hope This Works\", paragraph: \"This is very exciting.\" };\r\n```\r\n14. Run your jQuery app, and open your console. You should see `ngOnInit Fired. undefined` as the only printed line, and your custom component should exist in the DOM but display nothing, as `propTest` was never set. If you take a look at the code in app.component.ts, this means that ngOnChanges is never actually running, otherwise we should see another log statement `ngOnChanges Fired.`, which we don't. You can also add `console.dir(propTest);` and see that `testProp` IS being set on the HTMLElement, it just doesn't propagate to the Angular. \r\n\r\nIf I am missing something, can someone please point me towards the proper documentation? I found it very difficult to find good information on the process of creating an Angular Element and hosting it in a non-angular application.\r\n\r\ndependencies from final package.json are: \r\n```\r\n  \"dependencies\": {\r\n    \"@angular/animations\": \"~7.2.0\",\r\n    \"@angular/common\": \"~7.2.0\",\r\n    \"@angular/compiler\": \"~7.2.0\",\r\n    \"@angular/core\": \"~7.2.0\",\r\n    \"@angular/elements\": \"^7.2.15\",\r\n    \"@angular/forms\": \"~7.2.0\",\r\n    \"@angular/platform-browser\": \"~7.2.0\",\r\n    \"@angular/platform-browser-dynamic\": \"~7.2.0\",\r\n    \"@angular/router\": \"~7.2.0\",\r\n    \"core-js\": \"^2.5.4\",\r\n    \"document-register-element\": \"^1.7.2\",\r\n    \"ngx-build-plus\": \"^7.8.3\",\r\n    \"rxjs\": \"~6.3.3\",\r\n    \"tslib\": \"^1.9.0\",\r\n    \"zone.js\": \"~0.8.26\"\r\n  }\r\n```\r\n","author":{"url":"https://github.com/CollinGraf314","@type":"Person","name":"CollinGraf314"},"datePublished":"2019-06-14T15:14:53Z","url":"https://github.com/angular/angular/issues/31055"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:46d0311a-56a0-2423-d2c3-2f4366e8e362
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD5F8:29AEE8:1192FFC:177504A:6B011B98
html-safe-nonce9d59b3578af230d4140233757d9000c2b519eb4b38e32ff9d91b8a58ef835153
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUY4OjI5QUVFODoxMTkyRkZDOjE3NzUwNEE6NkIwMTFCOTgiLCJ2aXNpdG9yX2lkIjoiNTkzMDIwNzE3MDExMjA2ODUwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac78a0c2fff7e2e70c5dee28a65066a7afba160eb80fae826510d49c3c05567b7d
hovercard-subject-tagissue:456300831
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/31055/issue_layout
twitter:imagehttps://opengraph.githubassets.com/53aec124d22ec626869114d0fd5f37027d7b27091cfdfb54811803048873ecfc/angular/angular/issues/31055
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/53aec124d22ec626869114d0fd5f37027d7b27091cfdfb54811803048873ecfc/angular/angular/issues/31055
og:image:alt🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? Unknown Description In an Angular Element hosted by a JQuery project, if JQuery tries to set the...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameCollinGraf314
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/31055#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F31055
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F31055
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/31055
Reloadhttps://github.com/angular/angular/issues/31055
Reloadhttps://github.com/angular/angular/issues/31055
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/31055
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/31055
Angular Element issue with change detection running on Property value changehttps://github.com/angular/angular/issues/31055#top
https://github.com/CollinGraf314
CollinGraf314https://github.com/CollinGraf314
on Jun 14, 2019https://github.com/angular/angular/issues/31055#issue-456300831
@inputhttps://github.com/input
https://github.com/remackgeek
remackgeekhttps://github.com/remackgeek
on Jun 14, 2019https://github.com/angular/angular/issues/31055#issuecomment-502161512
#24181https://github.com/angular/angular/issues/24181
#1133https://github.com/angular/zone.js/pull/1133
https://github.com/CollinGraf314
CollinGraf314https://github.com/CollinGraf314
on Jun 14, 2019https://github.com/angular/angular/issues/31055#issuecomment-502192532
@remackgeekhttps://github.com/remackgeek
#24181https://github.com/angular/angular/issues/24181
https://github.com/CollinGraf314
CollinGraf314https://github.com/CollinGraf314
on Jun 14, 2019https://github.com/angular/angular/issues/31055#issuecomment-502210337
CollinGraf314https://github.com/CollinGraf314
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 14, 2019https://github.com/angular/angular/issues/31055#event-2414456911
https://github.com/antch
antchhttps://github.com/antch
on Jun 14, 2019https://github.com/angular/angular/issues/31055#issuecomment-502227563
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 15, 2019https://github.com/angular/angular/issues/31055#issuecomment-531534583
automatic conversation locking policyhttps://github.com/angular/angular/blob/67d80f/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 15, 2019https://github.com/angular/angular/issues/31055#event-2634464047
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/31055
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/31055
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.