Title: Error: No provider for InjectionToken mat-autocomplete-scroll-strategy · Issue #35759 · angular/angular · GitHub
Open Graph Title: Error: No provider for InjectionToken mat-autocomplete-scroll-strategy · Issue #35759 · angular/angular
X Title: Error: No provider for InjectionToken mat-autocomplete-scroll-strategy · Issue #35759 · angular/angular
Description: I upgraded my project from Angular 8 to 9 and refactored my code to take advantage of the ability to lazy load components. For most of my components this works great, but I have one that is throwing an error and I need help resolving the...
Open Graph Description: I upgraded my project from Angular 8 to 9 and refactored my code to take advantage of the ability to lazy load components. For most of my components this works great, but I have one that is throwin...
X Description: I upgraded my project from Angular 8 to 9 and refactored my code to take advantage of the ability to lazy load components. For most of my components this works great, but I have one that is throwin...
Opengraph URL: https://github.com/angular/angular/issues/35759
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error: No provider for InjectionToken mat-autocomplete-scroll-strategy ","articleBody":"I upgraded my project from Angular 8 to 9 and refactored my code to take advantage of the ability to lazy load components. For most of my components this works great, but I have one that is throwing an error and I need help resolving the issue.\r\n\r\nHere is my component code followed by the error. The module is defined in the same file as the component.\r\n\r\n```javascript\r\nimport { Component, OnInit, OnDestroy, NgModule } from '@angular/core';\r\nimport { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { switchMap, debounceTime, tap, filter } from 'rxjs/operators';\r\nimport { MatFormFieldModule, MatInputModule, MatAutocompleteModule, MatButtonModule, MatProgressSpinnerModule, MatIconModule, MatDialogModule } from '@angular/material';\r\n \r\nimport { SearchService } from './search.service';\r\nimport { SuggestResult } from './suggest-result';\r\nimport { CommonModule } from '@angular/common';\r\nimport { HttpClientModule } from '@angular/common/http';\r\nimport { SharedModule } from 'src/app/shared/shared.module';\r\n \r\n@Component({\r\n selector: 'app-search',\r\n templateUrl: './search.component.html',\r\n styleUrls: ['./search.component.scss'],\r\n providers: [ FormBuilder]\r\n})\r\nexport class SearchComponent implements OnInit, OnDestroy {\r\n \r\n//code removed\r\n \r\n}\r\n \r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n HttpClientModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatAutocompleteModule,\r\n MatButtonModule,\r\n MatProgressSpinnerModule,\r\n MatIconModule,\r\n SharedModule,\r\n MatDialogModule\r\n ],\r\n declarations: [SearchComponent]\r\n})\r\nexport class SearchModule { }\r\n ```\r\n\r\n```html\r\n\u003cdiv>\r\n \u003cdiv class=\"form-container\">\r\n \u003cform [formGroup]='resultsForm'>\r\n \u003cmat-form-field [class.mat-form-field-invalid]=\"!formFieldValid\">\r\n \u003cinput matInput placeholder=\"Search term\" type=\"search\" [matAutocomplete]=\"SearchAuto\" formControlName='SearchUserInput'>\r\n \u003c/mat-form-field>\r\n\r\n \u003cdiv *ngIf=\"!formFieldValid\" class=\"error-msg\"> {{ errorMessage }} \u003c/div>\r\n \r\n \u003cmat-autocomplete #SearchAuto=\"matAutocomplete\" [displayWith]=\"getSelectedText\"\r\n (optionSelected)='onItemSelected($event.option.value)'>\r\n \u003cmat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n \u003cmat-spinner mode=\"indeterminate\" diameter=\"25\">\u003c/mat-spinner>\r\n \u003c/mat-option>\r\n\r\n \u003cng-container *ngIf=\"!isLoading\">\r\n \u003cmat-option *ngFor=\"let result of filteredResults\" [value]=\"result\">\r\n \u003cspan>{{ result.name }}\u003c/span>\r\n \u003c/mat-option>\r\n \u003c/ng-container>\r\n \u003c/mat-autocomplete>\r\n \u003c/form>\r\n \u003cmat-icon>search\u003c/mat-icon>\r\n \u003cbutton mat-button *ngIf=\"isNotEmpty()\" matSuffix mat-icon-button aria-label=\"Clear\" (click)=\"clearSearch()\">\r\n \u003cmat-icon>close\u003c/mat-icon>\r\n \u003c/button>\r\n \u003c/div>\r\n\u003c/div>\r\n\r\n```\r\n \r\n The error:\r\n\r\nnull: Error: Uncaught (in promise): NullInjectorError: R3InjectorError(AppModule)[InjectionToken mat-autocomplete-scroll-strategy -> InjectionToken mat-autocomplete-scroll-strategy -> InjectionToken mat-autocomplete-scroll-strategy]: \r\n NullInjectorError: No provider for InjectionToken mat-autocomplete-scroll-strategy!\r\n./node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js/NullInjector.prototype.get@http://localhost:4200/vendor.js:37066:25\r\n./node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js/R3Injector.prototype.get@http://localhost:4200/vendor.js:47422:33\r\n./node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js/R3Injector.prototype.get@http://localhost:4200/vendor.js:47422:33\r\n./node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js/R3Injector.prototype.get@http://localhost:4200/vendor.js:47422:33\r\n./node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js/NgModuleRef$1.prototype.get@http://localhost:4200/vendor.js:60382:33\r\nget@http://localhost:4200/vendor.js:58703:35\r\ngetOrCreateInjectable@http://localhost:4200/vendor.js:39763:39\r\nɵɵdirectiveInject@http://localhost:4200/vendor.js:50290:12\r\nMatAutocompleteTrigger_Factory@http://localhost:4200/vendor.js:76965:788\r\ngetNodeInjectable@http://localhost:4200/vendor.js:39871:44\r\nsearchTokensOnInjector@http://localhost:4200/vendor.js:39807:16\r\ngetOrCreateInjectable@http://localhost:4200/vendor.js:39729:58\r\nɵɵdirectiveInject@http://localhost:4200/vendor.js:50290:12\r\nɵɵinject@http://localhost:4200/vendor.js:36956:57\r\nfactory@http://localhost:4200/vendor.js:47681:44\r\nmultiResolve@http://localhost:4200/vendor.js:55407:21\r\nmultiProvidersFactoryResolver@http://localhost:4200/vendor.js:55372:12\r\ngetNodeInjectable@http://localhost:4200/vendor.js:39871:44\r\nsearchTokensOnInjector@http://localhost:4200/vendor.js:39807:16\r\ngetOrCreateInjectable@http://localhost:4200/vendor.js:39729:58\r\nɵɵdirectiveInject@http://localhost:4200/vendor.js:50290:12\r\nFormControlName_Factory@http://localhost:4200/vendor.js:74579:400\r\ngetNodeInjectable@http://localhost:4200/vendor.js:39871:44\r\nsearchTokensOnInjector@http://localhost:4200/vendor.js:39807:16\r\ngetOrCreateInjectable@http://localhost:4200/vendor.js:39729:58\r\nɵɵdirectiveInject@http://localhost:4200/vendor.js:50290:12\r\nɵɵinject@http://localhost:4200/vendor.js:36956:57\r\nfactory@http://localhost:4200/vendor.js:47681:44\r\ngetNodeInjectable@http://localhost:4200/vendor.js:39871:44\r\nsearchTokensOnInjector@http://localhost:4200/vendor.js:39807:16\r\ngetOrCreateInjectable@http://localhost:4200/vendor.js:39729:58\r\nɵɵdirectiveInject@http://localhost:4200/vendor.js:50290:12\r\nMatInput_Factory@http://localhost:4200/vendor.js:99837:370\r\ngetNodeInjectable@http://localhost:4200/vendor.js:39871:44\r\ninstantiateAllDirectives@http://localhost:4200/vendor.js:44362:42\r\ncreateDirectivesInstances@http://localhost:4200/vendor.js:43753:29\r\nɵɵelementStart@http://localhost:4200/vendor.js:50436:34\r\nɵɵelement@http://localhost:4200/vendor.js:50487:19\r\nSearchComponent_Template@http://localhost:4200/search-search-search-component.js:190:56\r\nexecuteTemplate@http://localhost:4200/vendor.js:43726:19\r\nrenderView@http://localhost:4200/vendor.js:43551:28\r\nrenderComponent@http://localhost:4200/vendor.js:44741:15\r\nrenderChildComponents@http://localhost:4200/vendor.js:43412:24\r\nrenderView@http://localhost:4200/vendor.js:43576:34\r\n./node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js/ComponentFactory.prototype.create@http://localhost:4200/vendor.js:58804:23\r\ncreateContainerRef/R3ViewContainerRef\u003c/ViewContainerRef.prototype.createComponent@http://localhost:4200/vendor.js:46481:53\r\n./src/app/dynamic-loader/dynamic-loader.service.ts/DynamicLoaderService.prototype.addComponentToContainer/obs\u003c@http://localhost:4200/main.js:583:23\r\n./node_modules/zone.js/dist/zone.js/\u003c/Zone$1\u003c/ZoneDelegate\u003c/ZoneDelegate.prototype.invoke@http://localhost:4200/polyfills.js:2740:30\r\nonInvoke@http://localhost:4200/vendor.js:63629:33\r\n./node_modules/zone.js/dist/zone.js/\u003c/Zone$1\u003c/ZoneDelegate\u003c/ZoneDelegate.prototype.invoke@http://localhost:4200/polyfills.js:2739:36\r\n./node_modules/zone.js/dist/zone.js/\u003c/Zone$1\u003c/Zone\u003c/Zone.prototype.run@http://localhost:4200/polyfills.js:2497:47\r\nscheduleResolveOrReject/\u003c@http://localhost:4200/polyfills.js:3238:38\r\n./node_modules/zone.js/dist/zone.js/\u003c/Zone$1\u003c/ZoneDelegate\u003c/ZoneDelegate.prototype.invokeTask@http://localhost:4200/polyfills.js:2775:35\r\nonInvokeTask@http://localhost:4200/vendor.js:63617:33\r\n./node_modules/zone.js/dist/zone.js/\u003c/Zone$1\u003c/ZoneDelegate\u003c/ZoneDelegate.prototype.invokeTask@http://localhost:4200/polyfills.js:2774:40\r\n./node_modules/zone.js/dist/zone.js/\u003c/Zone$1\u003c/Zone\u003c/Zone.prototype.runTask@http://localhost:4200/polyfills.js:2542:51\r\ndrainMicroTaskQueue@http://localhost:4200/polyfills.js:2955:39\r\n","author":{"url":"https://github.com/schinks","@type":"Person","name":"schinks"},"datePublished":"2020-02-28T17:17:19Z","url":"https://github.com/angular/angular/issues/35759"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e44a000d-4634-6d3c-e7ed-3b62531248bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B50E:91CF4:C5B0FA:1072B21:6B00F37F |
| html-safe-nonce | 351a45dadb8f67d5226fe4f8a182c4a44476600403968f747d9ab1f28e56dfde |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTBFOjkxQ0Y0OkM1QjBGQToxMDcyQjIxOjZCMDBGMzdGIiwidmlzaXRvcl9pZCI6IjYxMTc0Nzk5MjQ3NDQ5MDk2OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 507eec5cd1e1edd279dbd8be9089c35168a4e1ae2ab07bb1eb76e54c3978ad34 |
| hovercard-subject-tag | issue:572890722 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/35759/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9be9eb58a7ba0726d461e9e451db0ef4fb0a122ab4e86167e0dc370263d3bb4a/angular/angular/issues/35759 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9be9eb58a7ba0726d461e9e451db0ef4fb0a122ab4e86167e0dc370263d3bb4a/angular/angular/issues/35759 |
| og:image:alt | I upgraded my project from Angular 8 to 9 and refactored my code to take advantage of the ability to lazy load components. For most of my components this works great, but I have one that is throwin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | schinks |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width