René's URL Explorer Experiment


Title: Add html dynamically to an element · Issue #23916 · angular/angular · GitHub

Open Graph Title: Add html dynamically to an element · Issue #23916 · angular/angular

X Title: Add html dynamically to an element · Issue #23916 · angular/angular

Description: I need to dynamically add an html to an element of the template This is the code that I have in my component import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @C...

Open Graph Description: I need to dynamically add an html to an element of the template This is the code that I have in my component import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core'; import { Http...

X Description: I need to dynamically add an html to an element of the template This is the code that I have in my component import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core'; impor...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add html dynamically to an element","articleBody":"## I need to dynamically add an html to an element of the template\r\nThis is the code that I have in my component\r\n\u003cpre>\r\n\u003ccode>\r\nimport { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: './app.component.html',\r\n  styleUrls: ['./app.component.css']\r\n})\r\nexport class AppComponent {\r\n\r\n  private title:string = 'app';\r\n  private viewContent:any;\r\n  private viewFile:string;\r\n\r\n  constructor(private http: HttpClient){}\r\n\r\n  ngOnInit(){\r\n  \tthis.http.get('assets/views/default.html', {responseType: 'text'}).subscribe(data => {\r\n    \tthis.viewFile = 'default.html';\r\n    \tthis.viewContent = data;\r\n\t  });\r\n  }\r\n}\r\n\u003c/code>\u003c/pre>\r\n\r\nThe app.component.html\r\n```html\r\n\u003cdiv style=\"text-align:center\">\r\n  \u003ch1>\r\n    Welcome to {{ title }}!\r\n  \u003c/h1>\r\n  \u003cimg width=\"300\" alt=\"Angular Logo\" src=\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==\">\r\n\u003c/div>\r\n\u003ch2>The next view is load from {{ viewFile }} \u003c/h2>\r\n\r\n\u003cdiv>{{ viewContent }}\u003c/div> ==> this shows: \u003cdiv> Default template {{viewFile}} \u003c/div>\r\n\u003cdiv [innerHTML]=\"viewContent\">\u003c/div> ==> this shows: Default template {{viewFile}}\r\n```\r\n\r\nAnd the file that I want to load that is located in the route: assets/views/default.html\r\n```html\r\n\u003cdiv>\r\n\tDefault template {{viewFile}}\r\n\u003c/div>\r\n```\r\n\r\n## Current behavior\r\n* There is a folder with an html file\r\n* The file is read as text using a get http request\r\n* The content is shown in the template\r\n\r\nThe problem I have is that the content of the html is loaded as text in the template. I could solve that part if I used `[innerHtml]` and passed the contents of the html file, but I have a problem when the file has interpolation variables `{{var}}` because these are not loaded by Angular\r\n\r\n## Expected behavior\r\nDynamically load html files located in a project folder and display them in some element of the template detecting its variables when adding it. The following is what is expected to be displayed in the template when the `viewContent` variable is loaded into some element:\r\n```\r\nDefault template default.html\r\n```\r\n\r\n## Environment\r\n\r\n\u003cpre>\u003ccode>\r\nAngular version: 4.1.3\r\n\r\nBrowser:\r\n- [x ] Safari (desktop) version 11.1\r\n\r\nFor Tooling issues:\r\n- Node version: 8.11.1\r\n- Platform:  Mac High Sierra 10.13.4\r\n\u003c/code>\u003c/pre>","author":{"url":"https://github.com/camilo-5972","@type":"Person","name":"camilo-5972"},"datePublished":"2018-05-15T15:22:17Z","url":"https://github.com/angular/angular/issues/23916"}

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:c4c4a4f2-da88-cf8c-c037-ae961f8ac0e8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA210:3F4253:F03170:14046D6:6B010CC9
html-safe-noncede7db3092aabaad8e6133c2ab95cd8c7e967c973635d1c1a8b98e23d889b4967
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjEwOjNGNDI1MzpGMDMxNzA6MTQwNDZENjo2QjAxMENDOSIsInZpc2l0b3JfaWQiOiI2MDMyMjU4MjIxNTg1MDA5ODY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7843995e325d38765188e110d181bde7bb6e40b1a0660478452240649e4a54ad
hovercard-subject-tagissue:323266852
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/23916/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d7b0b831b8abff52a38b9b10ea79ca684fcbdbc033256ac9383e6e787c59ed4a/angular/angular/issues/23916
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d7b0b831b8abff52a38b9b10ea79ca684fcbdbc033256ac9383e6e787c59ed4a/angular/angular/issues/23916
og:image:altI need to dynamically add an html to an element of the template This is the code that I have in my component import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core'; import { Http...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecamilo-5972
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
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
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/23916#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F23916
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%2F23916
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/23916
Reloadhttps://github.com/angular/angular/issues/23916
Reloadhttps://github.com/angular/angular/issues/23916
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/23916
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/23916
Add html dynamically to an elementhttps://github.com/angular/angular/issues/23916#top
https://github.com/camilo-5972
camilo-5972https://github.com/camilo-5972
on May 15, 2018https://github.com/angular/angular/issues/23916#issue-323266852
https://github.com/mlc-mlapis
mlc-mlapishttps://github.com/mlc-mlapis
on May 15, 2018https://github.com/angular/angular/issues/23916#issuecomment-389209512
@camilo-5972https://github.com/camilo-5972
https://github.com/camilo-5972
camilo-5972https://github.com/camilo-5972
on May 15, 2018https://github.com/angular/angular/issues/23916#issuecomment-389210991
https://github.com/mlc-mlapis
mlc-mlapishttps://github.com/mlc-mlapis
on May 15, 2018https://github.com/angular/angular/issues/23916#issuecomment-389214857
@camilo-5972https://github.com/camilo-5972
https://angular.iohttps://angular.io
https://github.com/IgorMinar
IgorMinarhttps://github.com/IgorMinar
on May 22, 2018https://github.com/angular/angular/issues/23916#issuecomment-391164910
@mlc-mlapishttps://github.com/mlc-mlapis
@camilo-5972https://github.com/camilo-5972
https://angular.io/guide/elementshttps://angular.io/guide/elements
IgorMinarhttps://github.com/IgorMinar
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 22, 2018https://github.com/angular/angular/issues/23916#event-1640528271
https://github.com/hinalshah91
hinalshah91https://github.com/hinalshah91
on Jul 19, 2018https://github.com/angular/angular/issues/23916#issuecomment-406176144
https://github.com/mlc-mlapis
mlc-mlapishttps://github.com/mlc-mlapis
on Jul 19, 2018https://github.com/angular/angular/issues/23916#issuecomment-406184309
@hinalshah91https://github.com/hinalshah91
https://github.com/hinalshah91
hinalshah91https://github.com/hinalshah91
on Jul 19, 2018https://github.com/angular/angular/issues/23916#issuecomment-406223121
@mlc-mlapishttps://github.com/mlc-mlapis
https://github.com/mlc-mlapis
mlc-mlapishttps://github.com/mlc-mlapis
on Jul 19, 2018https://github.com/angular/angular/issues/23916#issuecomment-406243409
@hinalshah91https://github.com/hinalshah91
https://is-angular-ivy-ready.firebaseapp.com/#/statushttps://is-angular-ivy-ready.firebaseapp.com/#/status
https://github.com/suparnavg
suparnavghttps://github.com/suparnavg
on Dec 5, 2018https://github.com/angular/angular/issues/23916#issuecomment-444436446
@camilo-5972https://github.com/camilo-5972
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 14, 2019https://github.com/angular/angular/issues/23916#issuecomment-531466566
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 14, 2019https://github.com/angular/angular/issues/23916#event-2634053967
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/23916
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/23916
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.