René's URL Explorer Experiment


Title: '$locationShim': Not a valid '@angular/upgrade' application. · Issue #46211 · angular/angular · GitHub

Open Graph Title: '$locationShim': Not a valid '@angular/upgrade' application. · Issue #46211 · angular/angular

X Title: '$locationShim': Not a valid '@angular/upgrade' application. · Issue #46211 · angular/angular

Description: Description I'm getting issues implementing ngUpgrade according to the official docs. I am at the stage when everything works, except navigation from Angular 1 to Angular 13. It is not clear from the docs where this code should be put: a...

Open Graph Description: Description I'm getting issues implementing ngUpgrade according to the official docs. I am at the stage when everything works, except navigation from Angular 1 to Angular 13. It is not clear from t...

X Description: Description I'm getting issues implementing ngUpgrade according to the official docs. I am at the stage when everything works, except navigation from Angular 1 to Angular 13. It is not clear fr...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'$locationShim': Not a valid '@angular/upgrade' application.","articleBody":"### Description\n\nI'm getting issues implementing ngUpgrade according to the official docs.\r\nI am at the stage when everything works, except navigation from Angular 1 to Angular 13.\r\nIt is not clear from the docs where this code should be put:\r\n\r\n```\r\nangular.module('rxntBillingApp')\r\n          .factory('$location', downgradeInjectable($locationShim));\r\n```\r\nI tried putting it before `app.bootstrap(el)` in LazyLoaderService, but this results in an error:\r\n\r\n> lazy-loader.service.ts:21 Error: Error while instantiating injectable '$locationShim': Not a valid '@angular/upgrade' application. Did you forget to downgrade an Angular module or include it in the AngularJS application?\r\n\r\nThis is a valid angular upgrade application because when this `$locationShim` downgrade is removed, everything works fine. The reason to introduce location shim is to unify routing, so that AngularJS application can route back to Angular 13 app.\r\n\r\nIt's not very clear from the docs, but I changed `this.upgrade.bootstrap` inside app.module.ts to bootstrap a regular AppComponent, which then has `\u003crouter-outlet>` and routes to Angular 13 test component or to AngularJS component which lazily loads all the static assets and performs the bootstrap.\r\n\r\n```ts\r\n// app-routing.module.ts\r\nexport const routes: Routes = [\r\n  // Routes rendered by Angular\r\n  { path: 'test-component', component: TestComponent },\r\n\r\n  // AngularJS routes\r\n  { path: '**', component: AngularJSComponent },\r\n];\r\n\r\n@NgModule({\r\n  imports: [RouterModule.forRoot(routes)],\r\n  exports: [RouterModule]\r\n})\r\nexport class AppRoutingModule { }\r\n```\r\n\r\n```ts\r\n// angular-js.component.ts\r\nexport class AngularJSComponent implements OnInit, OnDestroy {\r\n  constructor(\r\n    private lazyLoader: LazyLoaderService,\r\n    private elRef: ElementRef\r\n  ) {}\r\n\r\n  ngOnInit() {\r\n    this.lazyLoader.load(this.elRef.nativeElement);\r\n  }\r\n\r\n  ngOnDestroy() {\r\n    this.lazyLoader.destroy();\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the code for `LazyLoaderService`, which is following the official example:\r\n\r\n```ts\r\nimport { Injectable } from '@angular/core';\r\nimport angular from 'angular';\r\nimport { downgradeInjectable } from '@angular/upgrade/static';\r\nimport { $locationShim } from '@angular/common/upgrade';\r\n\r\n@Injectable({\r\n  providedIn: 'root'\r\n})\r\nexport class LazyLoaderService {\r\n  private app: angular.auto.IInjectorService | undefined;\r\n\r\n  load(el: HTMLElement): void {\r\n    import(/* webpackChunkName: \"main.legacy\" */ '../../app/index').then(app => {\r\n      try {\r\n        angular.module('rxntBillingApp')\r\n          .factory('$location', downgradeInjectable($locationShim));  // tried adding this code:\r\n        \r\n        this.app = app.bootstrap(el);\r\n      } catch (e) {\r\n        console.error(e);\r\n      }\r\n    });\r\n  }\r\n\r\n  destroy() {\r\n    if (this.app) {\r\n      this.app.get('$rootScope').$destroy();\r\n    }\r\n  }\r\n}\r\n```\r\n\r\napp.bootstrap code is as follows:\r\n\r\n```ts\r\nexport function bootstrap(el: HTMLElement) {\r\n  return angular.bootstrap(el, ['rxntBillingApp']);  \r\n}\r\n```\r\n\r\nPlease advise if you can see anything wrong with the above implementation.\n\n### What is the affected URL?\n\nhttps://angular.io/guide/upgrade#using-the-unified-angular-location-service\n\n### Please provide the steps to reproduce the issue\n\n_No response_\n\n### Please provide the expected behavior vs the actual behavior you encountered\n\n_No response_\n\n### Please provide a screenshot if possible\n\n_No response_\n\n### Please provide the exception or error you saw\n\n_No response_\n\n### Is this a browser-specific issue? If so, please specify the device, browser, and version.\n\n_No response_","author":{"url":"https://github.com/vzakharov-rxnt","@type":"Person","name":"vzakharov-rxnt"},"datePublished":"2022-06-01T15:04:52Z","url":"https://github.com/angular/angular/issues/46211"}

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:fb24035e-8e35-65e9-be37-54daaf7affa1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD15E:7A60E:BECC05:F7818D:6B00EED2
html-safe-noncee8131d7a6e7e299919153efbf9375fe420e3064e5be8d1db5b364c80472e33ff
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTVFOjdBNjBFOkJFQ0MwNTpGNzgxOEQ6NkIwMEVFRDIiLCJ2aXNpdG9yX2lkIjoiNzIwODI5ODYxMTcyODI0ODUzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6fe75af851180bd944821fc81a491e9d3e0d965ffce5bc9a879096af052a8b8f
hovercard-subject-tagissue:1256234813
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/46211/issue_layout
twitter:imagehttps://opengraph.githubassets.com/27fc0de250cca6649ca14ac80835a804b9661754cbb93dd7bbac21090f4756c2/angular/angular/issues/46211
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/27fc0de250cca6649ca14ac80835a804b9661754cbb93dd7bbac21090f4756c2/angular/angular/issues/46211
og:image:altDescription I'm getting issues implementing ngUpgrade according to the official docs. I am at the stage when everything works, except navigation from Angular 1 to Angular 13. It is not clear from t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevzakharov-rxnt
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/46211#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F46211
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%2F46211
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/46211
Reloadhttps://github.com/angular/angular/issues/46211
Reloadhttps://github.com/angular/angular/issues/46211
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests140 (140)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/46211
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/46211
'$locationShim': Not a valid '@angular/upgrade' application.https://github.com/angular/angular/issues/46211#top
area: upgradeIssues related to AngularJS → Angular upgrade APIshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20upgrade%22
needsTriagehttps://github.com/angular/angular/milestone/83
https://github.com/vzakharov-rxnt
vzakharov-rxnthttps://github.com/vzakharov-rxnt
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issue-1256234813
https://angular.io/guide/upgrade#using-the-unified-angular-location-servicehttps://angular.io/guide/upgrade#using-the-unified-angular-location-service
https://github.com/vzakharov-rxnt
vzakharov-rxnthttps://github.com/vzakharov-rxnt
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issuecomment-1143747366
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issuecomment-1143867413
UpgradeModule#bootstrap()https://angular.io/api/upgrade/static/UpgradeModule#bootstrap
angular.bootstrap()https://docs.angularjs.org/api/ng/function/angular.bootstrap
UpgradeModule#$injectorhttps://angular.io/api/upgrade/static/UpgradeModule#%24injector
https://github.com/vzakharov-rxnt
vzakharov-rxnthttps://github.com/vzakharov-rxnt
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issuecomment-1143961680
@gkalpakhttps://github.com/gkalpak
atscotthttps://github.com/atscott
area: upgradeIssues related to AngularJS → Angular upgrade APIshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20upgrade%22
on Jun 1, 2022https://github.com/angular/angular/issues/46211#event-6722051538
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Jun 1, 2022https://github.com/angular/angular/issues/46211#event-6722051801
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issuecomment-1144028343
https://github.com/vzakharov-rxnt
vzakharov-rxnthttps://github.com/vzakharov-rxnt
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issuecomment-1144037032
@gkalpakhttps://github.com/gkalpak
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jun 1, 2022https://github.com/angular/angular/issues/46211#issuecomment-1144059790
https://github.com/vzakharov-rxnt
vzakharov-rxnthttps://github.com/vzakharov-rxnt
on Jun 2, 2022https://github.com/angular/angular/issues/46211#issuecomment-1144746258
@gkalpakhttps://github.com/gkalpak
https://angular.io/guide/upgrade#create-a-service-to-lazy-load-angularjshttps://angular.io/guide/upgrade#create-a-service-to-lazy-load-angularjs
alxhubhttps://github.com/alxhub
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
e9cb045https://github.com/angular/angular/commit/e9cb0454dce2113cfd5ba11deeca6cdcf47d47f0
on Jun 3, 2022https://github.com/angular/angular/issues/46211#event-6738483198
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jul 4, 2022https://github.com/angular/angular/issues/46211#issuecomment-1173970680
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jul 4, 2022https://github.com/angular/angular/issues/46211#event-6929133172
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/46211
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/46211
area: upgradeIssues related to AngularJS → Angular upgrade APIshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20upgrade%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.