René's URL Explorer Experiment


Title: Expose template source locations in dev mode to jump from the DOM to the template · Issue #70927 · angular/angular · GitHub

Open Graph Title: Expose template source locations in dev mode to jump from the DOM to the template · Issue #70927 · angular/angular

X Title: Expose template source locations in dev mode to jump from the DOM to the template · Issue #70927 · angular/angular

Description: Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description When I want to change something I see on the page, the slowest part isn't the edit itself (template/style HMR is great), it...

Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description When I want to change something I see on the page, the slowest part isn't the edit ...

X Description: Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description When I want to change something I see on the page, the slowest part isn't the e...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Expose template source locations in dev mode to jump from the DOM to the template","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\n\ncompiler, compiler-cli, core\n\n### Description\n\nWhen I want to change something I see on the page, the slowest part isn't the edit itself (template/style HMR is great), it's finding where that element lives. I open the browser inspector, look at markup full of `_ngcontent-*` attributes, guess which component it belongs to, and then search for the file and the line in my editor.\n\nOther ecosystems solve this with a \"click an element, open it in your editor\" tool (Svelte's inspector, Vue DevTools' open-in-editor, click-to-component for React). Angular doesn't have one, but most of the pieces are already in the framework:\n\n- #58982 added `ɵɵattachSourceLocations`, which puts a `data-ng-source-location=\"src/app/foo.html@o:…,l:…,c:…\"` attribute on every template element. The PR description says it's aimed at internal tools but that \"we may consider exposing this in dev mode in the future\".\n- #70303 added the `enableTemplateSourceLocations` compiler option (under the internal Bazel/g3 options).\n- `ng serve` runs on Vite, which already exposes `/__open-in-editor` (the `launch-editor` middleware used by Vite, Vue and Nuxt). It detects the running editor (VS Code, Cursor, WebStorm, Zed…) or uses the `LAUNCH_EDITOR` env variable, so Angular doesn't need to know anything about editors.\n\nI wanted to see how far these get us, so I built a small prototype on a fresh `ng new` app (v22.2.0). I enabled the option in a `tsconfig.dev.json` used only by the `development` configuration. Then I added a ~120 line dev-only script: hold Alt and hover to see the component and `file:line:col`, Alt+click calls `/__open-in-editor?file=\u003cpath>:\u003cline>:\u003ccol>` and the editor opens on that line.\n\nPrototype: https://github.com/aminesbdev/angular-source-inspector (see `src/dev/source-inspector.ts` and `tsconfig.dev.json`).\n\nIt worked better than I expected. I checked the locations in headless Chrome, and each one lands on the exact tag: external templates (`product-card.html:6:3` → `\u003cbutton class=\"buy\">`), inline templates (`price-tag.ts:7:7` → the `\u003cstrong>` inside the `template` string), and projected content. The compiler's project-relative paths work as-is with `/__open-in-editor`, since it resolves them from the directory where `ng serve` runs. With a real click, my editor opened on the right line. I did have to set `LAUNCH_EDITOR` because `launch-editor` doesn't detect my editor yet, but that's a one-line fix on their side.\n\nA few things I noticed along the way:\n\n- **Paths end up in production if you just turn it on.** Putting `enableTemplateSourceLocations` in `tsconfig.app.json` ships every template path in the production bundle (about 450 bytes on a three-component app). I only avoided it with a separate tsconfig for the development configuration, which isn't something most people would think to do.\n- A component's host element points to the template where it's *used*, not to its own template. That's probably right for this use case, but a tool would likely want both. The component's own class location is already available through its debug info, but only via `ɵcmp`.\n- I only tried a single-project workspace. In a multi-project workspace, the compiler's paths and the directory `/__open-in-editor` resolves from might not match.\n- `/__open-in-editor` comes from Vite and isn't something the Angular CLI documents, so tooling built on it would want the CLI to keep it around.\n\n### Proposed solution\n\nRoughly in this order:\n\n1. Make source locations safe to enable in dev: either the emitted instruction is dev-mode only, or the option is documented as a dev-only one. Then make the option public.\n2. Have `ng serve` turn it on by default for development builds (that part would be an angular-cli issue, I can open it there).\n3. Build tooling on top: an \"Open in editor\" action in Angular DevTools and/or an Alt+click overlay like the prototype. This could also start as a community package once the attribute is available.\n\nI'm happy to help with any of this if you think it's worth doing. I'm especially interested in steps 1 and 3.\n\n### Alternatives considered\n\n- **Component debug info only** (`ClassDebugInfo`, already emitted in dev mode). This gives the component class file and line, which is useful as a fallback, but not the template or the specific element. Reading it also requires `ɵcmp`.\n- **Chrome DevTools workspaces.** They let you save edits back to files, but they don't tell you which component template an element comes from.\n- **Third-party tools** could do this today by reading private fields, but that breaks easily. A dev-mode attribute emitted by the compiler is a much more stable base to build on.\n","author":{"url":"https://github.com/aminesbdev","@type":"Person","name":"aminesbdev"},"datePublished":"2026-09-24T18:02:46Z","url":"https://github.com/angular/angular/issues/70927"}

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:7c27dc4a-a8df-5427-94af-a97ea0c55a3c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAC6A:35F933:10ED12:186B82:6AFDCD33
html-safe-nonceb6ed0f9346e0e9c1afa42b796a809a7c340580f07f33cb7a458bfb22c63ce6bb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzZBOjM1RjkzMzoxMEVEMTI6MTg2QjgyOjZBRkRDRDMzIiwidmlzaXRvcl9pZCI6IjYxMjk4NTQzNTY4ODQ2NzE3OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc38fc4c7fa2761a6284c78483ffdf1cec8fa14634988a325b5e8be259fafa24b
hovercard-subject-tagissue:5572471956
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/70927/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6417d5527e364be84ad7446513987ea672722649fde7034730ba2f9f854de142/angular/angular/issues/70927
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6417d5527e364be84ad7446513987ea672722649fde7034730ba2f9f854de142/angular/angular/issues/70927
og:image:altWhich @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description When I want to change something I see on the page, the slowest part isn't the edit ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameaminesbdev
hostnamegithub.com
expected-hostnamegithub.com
None26886a40b582b821a7a76351e0a2f42b6d6160854b6e2520db24f31fd7be5da7
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
release68ebaa631a1d248d69ebde4b9c5defd3a19aeb2f
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/70927#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F70927
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%2F70927
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/70927
Reloadhttps://github.com/angular/angular/issues/70927
Reloadhttps://github.com/angular/angular/issues/70927
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues833 (833)https://github.com/angular/angular/issues
Pull requests126 (126)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/70927
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/70927
Expose template source locations in dev mode to jump from the DOM to the templatehttps://github.com/angular/angular/issues/70927#top
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
needsTriagehttps://github.com/angular/angular/milestone/83
https://github.com/aminesbdev
aminesbdevhttps://github.com/aminesbdev
on Sep 24, 2026https://github.com/angular/angular/issues/70927#issue-5572471956
Add internal-only debugging attributes #58982https://github.com/angular/angular/pull/58982
refactor(compiler-cli): add compiler option for enabling source locations #70303https://github.com/angular/angular/pull/70303
https://github.com/aminesbdev/angular-source-inspectorhttps://github.com/aminesbdev/angular-source-inspector
angular-robothttps://github.com/apps/angular-robot
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
gemini-triagedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
on Sep 24, 2026https://github.com/angular/angular/issues/70927#event-31779317388
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Sep 24, 2026https://github.com/angular/angular/issues/70927#event-31779319370
https://github.com/aminesbdev
aminesbdevhttps://github.com/aminesbdev
on Sep 27, 2026https://github.com/angular/angular/issues/70927#issuecomment-5853295857
https://raw.githubusercontent.com/aminesbdev/angular-source-inspector/main/docs/demo.gif
https://github.com/aminesbdev/angular-source-inspectorhttps://github.com/aminesbdev/angular-source-inspector
JeanMechehttps://github.com/JeanMeche
gemini-triagedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
on Oct 29, 2026https://github.com/angular/angular/issues/70927#event-34632126938
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/70927
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/70927
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
needsTriageNo due datehttps://github.com/angular/angular/milestone/83
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.