René's URL Explorer Experiment


Title: Got 'Uncaught Error: Can't resolve all parameters for AppComponent: (?).' when I inject whatever in construdtor(){} function · Issue #16837 · angular/angular · GitHub

Open Graph Title: Got 'Uncaught Error: Can't resolve all parameters for AppComponent: (?).' when I inject whatever in construdtor(){} function · Issue #16837 · angular/angular

X Title: Got 'Uncaught Error: Can't resolve all parameters for AppComponent: (?).' when I inject whatever in construdtor(){} function · Issue #16837 · angular/angular

Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [ ] feature request [x] support request => Please do not submit support request here, instead see https://github.com/an...

Open Graph Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [ ] feature request [x] support request => Please do not submit support request...

X Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [ ] feature request [x] support request => Please do not su...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Got 'Uncaught Error: Can't resolve all parameters for AppComponent: (?).' when I inject whatever in construdtor(){} function","articleBody":"**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[ ] bug report => search github for a similar issue or PR before submitting\r\n[ ] feature request\r\n[x] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nGot 'Uncaught Error: Can't resolve all parameters for AppComponent: (?).' when I inject whatever in construdtor(){} function\r\n\r\n**Expected behavior**\r\nWanna inject Router and use `router.navigate()` in AppComponent.\r\n```\r\nimport { Component } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: './app.component.html',\r\n})\r\nexport class AppComponent {\r\n  constructor(private router: Router){}\r\n}\r\n``` \r\n\r\nIt runs well when I remove `private router: Router`, and it causes error whatever I put into `construdtor(){}`. \r\n\r\nHere's my package.json:\r\n```\r\n{\r\n  \"name\": \"\",\r\n  \"version\": \"0.0.0\",\r\n  \"scripts\": {\r\n    \"build\": \"webpack --config webpack.config.js\",\r\n    \"dev\": \"webpack-dev-server --config webpackServer.config.js --host 0.0.0.0 --port 3333 --devtool eval --progress --colors --hot --content-base dist\"\r\n  },\r\n  \"dependencies\": {\r\n    \"@angular/common\": \"~4.1.2\",\r\n    \"@angular/compiler\": \"~4.1.2\",\r\n    \"@angular/compiler-cli\": \"~4.1.2\",\r\n    \"@angular/core\": \"~4.1.2\",\r\n    \"@angular/forms\": \"~4.1.2\",\r\n    \"@angular/http\": \"~4.1.2\",\r\n    \"@angular/platform-browser\": \"~4.1.2\",\r\n    \"@angular/platform-browser-dynamic\": \"~4.1.2\",\r\n    \"@angular/router\": \"~4.1.2\",\r\n    \"bootstrap\": \"^3.3.7\",\r\n    \"rxjs\": \"^5.1.0\",\r\n    \"zone.js\": \"^0.8.10\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"@types/node\": \"^7.0.18\",\r\n    \"angular2-template-loader\": \"~0.6.2\",\r\n    \"babel-core\": \"~6.24.1\",\r\n    \"babel-loader\": \"~7.0.0\",\r\n    \"babel-polyfill\": \"~6.23.0\",\r\n    \"babel-preset-latest\": \"^6.24.1\",\r\n    \"html-webpack-plugin\": \"^2.28.0\",\r\n    \"raw-loader\": \"^0.5.1\",\r\n    \"ts-loader\": \"^2.0.3\",\r\n    \"tslint\": \"^5.2.0\",\r\n    \"typescript\": \"~2.2.0\",\r\n    \"webpack\": \"~2.5.1\",\r\n    \"webpack-dev-server\": \"~2.4.5\"\r\n  }\r\n}\r\n```\r\n\r\nMy bootstrap.ts:\r\n```\r\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\r\nrequire('zone.js');\r\n\r\nimport { AppModule } from './app/container/container.module';\r\n\r\nplatformBrowserDynamic().bootstrapModule(AppModule);\r\n```\r\n\r\nAnd the AppModule:\r\n```\r\nimport { BrowserModule } from '@angular/platform-browser';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { HttpModule } from '@angular/http';\r\n\r\nimport { RouterModule, Routes, Router } from '@angular/router';\r\n\r\nimport { AppComponent } from './container.component';\r\nimport { LoginComponent } from '../modules/login/login.component';\r\n\r\nexport const AppRoutes: Routes = [\r\n    {\r\n        path: '', component: AppComponent, children: [\r\n            { path: 'login', component: LoginComponent },\r\n            { path: '**', redirectTo: 'login'}\r\n        ]\r\n    }\r\n];\r\n\r\n@NgModule({\r\n  imports: [\r\n    BrowserModule,\r\n    FormsModule,\r\n    // HttpModule,\r\n    RouterModule.forRoot(AppRoutes, {useHash: true})\r\n  ],\r\n  declarations: [\r\n    AppComponent,\r\n    LoginComponent\r\n  ],\r\n  providers: [],\r\n  bootstrap: [AppComponent]\r\n})\r\nexport class AppModule {\r\n}\r\n```\r\n\r\nHere's the error:\r\n```\r\ncompiler.es5.js:15291 \r\nUncaught Error: Can't resolve all parameters for LoginComponent: (?).\r\n    at syntaxError (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:1724:34)\r\n    at CompileMetadataResolver._getDependenciesMetadata (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:15061:35)\r\n    at CompileMetadataResolver._getTypeMetadata (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:14929:26)\r\n    at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:14538:24)\r\n    at CompileMetadataResolver._getEntryComponentMetadata (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:15182:45)\r\n    at eval (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:15168:48)\r\n    at Array.forEach (native)\r\n    at CompileMetadataResolver._getEntryComponentsFromProvider (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:15167:30)\r\n    at eval (webpack:///./~/@angular/compiler/@angular/compiler.es5.js?:15131:83)\r\n    at Array.forEach (native)\r\n```\r\n\r\nEverything runs well when I remove params in `constructor()`. Is it something about the DI?\r\nThanks for helping!\r\n","author":{"url":"https://github.com/godbasin","@type":"Person","name":"godbasin"},"datePublished":"2017-05-17T06:53:14Z","url":"https://github.com/angular/angular/issues/16837"}

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:52fda8ff-aa5c-0ce9-1a9e-084d1cf23ac9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA35C:937F2:5EBF1:7C2D0:6B02230A
html-safe-nonceee7325bd3a1b50422558ee0fdc7e1468ad8438a8e27baabbe78d09a057a5e008
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzVDOjkzN0YyOjVFQkYxOjdDMkQwOjZCMDIyMzBBIiwidmlzaXRvcl9pZCI6IjEzNzczNDYwNDU5NzI5ODA0OTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac496e9e3d0f292c5b1231bcd9e47a718c105ad8b1f15ad3003861ae721c11f1b2
hovercard-subject-tagissue:229253968
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/16837/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3f7ea629dac0fc9fbd074aa187bc206a59894be019e947172fbbb9c44319f232/angular/angular/issues/16837
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3f7ea629dac0fc9fbd074aa187bc206a59894be019e947172fbbb9c44319f232/angular/angular/issues/16837
og:image:altI'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [ ] feature request [x] support request => Please do not submit support request...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegodbasin
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/16837#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F16837
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%2F16837
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/16837
Reloadhttps://github.com/angular/angular/issues/16837
Reloadhttps://github.com/angular/angular/issues/16837
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests142 (142)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/16837
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/16837
Got 'Uncaught Error: Can't resolve all parameters for AppComponent: (?).' when I inject whatever in construdtor(){} functionhttps://github.com/angular/angular/issues/16837#top
https://github.com/godbasin
godbasinhttps://github.com/godbasin
on May 17, 2017https://github.com/angular/angular/issues/16837#issue-229253968
https://github.com/alexzuza
alexzuzahttps://github.com/alexzuza
on May 17, 2017https://github.com/angular/angular/issues/16837#issuecomment-302023207
https://github.com/godbasin
godbasinhttps://github.com/godbasin
on May 17, 2017https://github.com/angular/angular/issues/16837#issuecomment-302028837
herehttps://github.com/godbasin/godbasin.github.io/tree/blog-codes/angular2-free/3-init-routes-and-assets
https://github.com/alexzuza
alexzuzahttps://github.com/alexzuza
on May 17, 2017https://github.com/angular/angular/issues/16837#issuecomment-302056669
https://github.com/godbasin/godbasin.github.io/blob/blog-codes/angular2-free/3-init-routes-and-assets/src/app/container/container.component.tshttps://github.com/godbasin/godbasin.github.io/blob/blog-codes/angular2-free/3-init-routes-and-assets/src/app/container/container.component.ts
https://github.com/godbasin/godbasin.github.io/blob/blog-codes/angular2-free/3-init-routes-and-assets/src/app/container/container.routes.ts#L9https://github.com/godbasin/godbasin.github.io/blob/blog-codes/angular2-free/3-init-routes-and-assets/src/app/container/container.routes.ts#L9
https://github.com/godbasin
godbasinhttps://github.com/godbasin
on May 17, 2017https://github.com/angular/angular/issues/16837#issuecomment-302066375
godbasinhttps://github.com/godbasin
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 17, 2017https://github.com/angular/angular/issues/16837#event-1085826353
https://github.com/jasminecjc
jasminecjchttps://github.com/jasminecjc
on Mar 29, 2018https://github.com/angular/angular/issues/16837#issuecomment-377149035
https://github.com/DennisRauscher
DennisRauscherhttps://github.com/DennisRauscher
on May 7, 2018https://github.com/angular/angular/issues/16837#issuecomment-387006200
https://github.com/Oliver-Piorun
Oliver-Piorunhttps://github.com/Oliver-Piorun
on May 17, 2018https://github.com/angular/angular/issues/16837#issuecomment-389755130
@DennisRauscherhttps://github.com/DennisRauscher
https://github.com/tashoecraft
tashoecrafthttps://github.com/tashoecraft
on Jun 4, 2018https://github.com/angular/angular/issues/16837#issuecomment-394429777
https://github.com/abnerey
abnereyhttps://github.com/abnerey
on Jun 5, 2018https://github.com/angular/angular/issues/16837#issuecomment-394859335
https://github.com/tashoecraft
tashoecrafthttps://github.com/tashoecraft
on Jun 6, 2018https://github.com/angular/angular/issues/16837#issuecomment-395084043
https://github.com/jinkrish
jinkrishhttps://github.com/jinkrish
on Aug 7, 2018https://github.com/angular/angular/issues/16837#issuecomment-410951282
https://github.com/dongdongmao
dongdongmaohttps://github.com/dongdongmao
on Oct 23, 2018https://github.com/angular/angular/issues/16837#issuecomment-432169924
https://github.com/piecioshka
piecioshkahttps://github.com/piecioshka
on Nov 22, 2018https://github.com/angular/angular/issues/16837#issuecomment-441083572
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/16837#issuecomment-531461171
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/16837#event-2634020291
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/16837
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/16837
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.