\n\n \n `,\n})\nexport class App {\n name = 'Angular';\n}\n\nbootstrapApplication(App, {\n providers: [\n provideRouter(\n [\n {\n path: '**',\n component: MyComponent,\n data: { dataA: 'My static data' },\n resolve: { resolveA: () => 'My resolved data' },\n },\n ],\n ),\n ],\n});\n\nMyComponent should display both the static and the resolved data.\nAny idea why ?"}
+{"id": "000001", "text": "According to RFC3 signal-based components with change detection strategy based fully on signals are planned as next thing to be released. So as of now, with zone-based change detection strategy, is there any sense of using signals over the traditional way of setting values to class' properties? Will signals' dependency tree eg. gain performance in zone-based components?"}
+{"id": "000002", "text": "I have the following simple code on my component:\nimport {Component, effect, signal, WritableSignal} from '@angular/core';\nimport {AppService} from \"../app.service\";\nimport {toSignal} from \"@angular/core/rxjs-interop\";\n\n@Component({\n selector: 'app-parent',\n templateUrl: './parent.component.html',\n styleUrls: ['./parent.component.css']\n})\nexport class ParentComponent {\n\n translations: WritableSignal<{data: {}}> = signal({data: []});\n\n constructor( private appService: AppService) {\n this.translations = toSignal(this.appService.getTranslations());\n effect(() => {\n console.log('translation API:', this.translations());\n });\n }\n\n changeValue(): void {\n this.translations.set({data: {hello: 'hallo'}})\n\n }\n}\n\nFYI: this.appService.getTranslations() returns an observable\nI'm trying out the new features released with Angular v16, and how to convert Observables to Signals.\nWhat I wanted to do on the above code is, I change the value of the WritableSignal Object and log its value on change.\nI'm getting the following error:\nTS2739: Type 'Signal ' is missing the following properties from type 'WritableSignal{ data: {}; }>': set, update, mutate, asReadonly\n\nHelp please."}
+{"id": "000003", "text": "Angular 16 is recently released and I have created a new standalone project without any module.\nthen in a standalone component I need to import BrowserAnimationsModule from angular/platform-browser/animations. but when I import it, this error occures:\n\nPoviders from the BrowserModule have already been loaded. If you\nneed access to common directives such as NgIf and NgFor, import the\nCommonModule instead.\n\nand when I remove it this one:\n\nUnexpected synthetic listener @animation.start found. Please make sure\nthat: Either BrowserAnimationsModule or NoopAnimationsModule are\nimported in your application.\n\nso why first error occures? where is BrowserModule already loaded? and if it has already been imported how do I use it?"}
+{"id": "000004", "text": "Before signals, I had an observable that I would watch to trigger a FormControl's editable property, like this:\nthis.#isItEditor$\n .pipe(takeUntilDestroyed(this.#destroyRef))\n .subscribe(x => {\n const funded = this.formGroup.controls.funded\n if (x)\n funded.enable()\n else\n funded.disable()\n })\n\nNow I've changed from an observable to a signal, but it feels like, in this case, I still need to create an observable from the signal to then do the pipe/subscribe the same way I used to.\nI'm not assigning anything based on the signal changing, I'm just implementing a side effect. Is this correct?"}
+{"id": "000005", "text": "Example from (https://indepth.dev/posts/1518/takeuntildestroy-in-angular-v16)\nThis works for one subscribe method but doesn't work for two methods\nIf you look at the following code, then when the component is destroyed, the second subscription will exist. I just can't understand why and how to make the code work for any number of subscriptions in the component? Perhaps I misunderstood something?\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\n constructor(\n ) {\n interval(1000).pipe(\n takeUntilDestroyed(),\n ).subscribe(console.log)\n\n interval(1000).pipe(\n takeUntilDestroyed(),\n ).subscribe(console.log)\n }"}
+{"id": "000006", "text": "I am testing angular 16 signals and per my understanding, when I disable zone.js and call signal.update() the view should be updated with new value. It is not. Please help me to understand why.\nmain.ts\nplatformBrowserDynamic().bootstrapModule(AppModule, { ngZone: 'noop' })\n .catch(err => console.error(err));\n\napp.component.ts\n@Component({\n selector: 'app-root',\n template: '\n
{{ title() }}
\n \n ',\n})\nexport class AppComponent {\n title = signal('Hello');\n\n click(): void {\n this.title.update((value) => value + \"!!\");\n }\n}\n\nI am expecting that after button click, value of 'title' will be updated from 'Hello' to 'Hello!!'. It is not updated."}
+{"id": "000007", "text": "Code - https://github.com/suyashjawale/Angular16\nI have generated my Angular 16 project using following command and selected routing to yes.\nng new myapp --standalone\n\nAnd then I generated other components using\nng g c components/home\n\nSince, i used --standalone the boilerplate files are different. (Eg. New file app.routes.ts)\n File Structure\nNow I want to implement routing So I added the following code to app.routes.ts.\n app.routes.ts\n app.component.html\nBut the routing doesn't happen. Idk why?. I have restarted the app. still it doesn't work.\nSo i implemeted loadComponent. But still it doesn't work. Code below.\n loadComponent way.\nAm i doing anything wrong. It works with angular 15. But it has app.routing.module.ts. I have restarted the app but still it doesn't work.\nFYI - component is standalone\n\nhome.component.ts"}
+{"id": "000008", "text": "I am using Angular 16.0.0 and with Angular Universal server side rendering, but when I\nImport BrowserModule.withServerTransition in my app module its marked as deprecated, what is the replacement for it ?\n\nmy app.module.ts\nimport {BrowserModule} from '@angular/platform-browser';\nimport {NgModule} from '@angular/core';\n\nimport {AppRoutingModule} from './app-routing.module';\nimport {AppComponent} from './app.component';\nimport {BrowserAnimationsModule} from \"@angular/platform-browser/animations\";\nimport {MatMenuModule} from '@angular/material/menu';\nimport {MatButtonModule} from '@angular/material/button'\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatCardModule} from '@angular/material/card';\nimport { HomeComponent } from './home/home.component';\nimport {MatTabsModule} from '@angular/material/tabs';\nimport { CoursesCardListComponent } from './courses-card-list/courses-card-list.component';\nimport {CourseComponent} from \"./course/course.component\";\nimport { MatDatepickerModule } from \"@angular/material/datepicker\";\nimport { MatDialogModule } from \"@angular/material/dialog\";\nimport { MatInputModule } from \"@angular/material/input\";\nimport { MatListModule } from \"@angular/material/list\";\nimport { MatPaginatorModule } from \"@angular/material/paginator\";\nimport { MatProgressSpinnerModule } from \"@angular/material/progress-spinner\";\nimport { MatSelectModule } from \"@angular/material/select\";\nimport { MatSidenavModule } from \"@angular/material/sidenav\";\nimport { MatSortModule } from \"@angular/material/sort\";\nimport { MatTableModule } from \"@angular/material/table\";\nimport { MatToolbarModule } from \"@angular/material/toolbar\";\nimport {CoursesService} from \"./services/courses.service\";\nimport {CourseResolver} from \"./services/course.resolver\";\nimport { CourseDialogComponent } from './course-dialog/course-dialog.component';\nimport {ReactiveFormsModule} from \"@angular/forms\";\nimport { HttpClientModule} from '@angular/common/http';\nimport {AboutComponent} from './about/about.component';\n\n\n@NgModule({\n declarations: [\n AppComponent,\n HomeComponent,\n CourseComponent,\n CoursesCardListComponent,\n CourseDialogComponent,\n AboutComponent,\n\n ],\n imports: [\n BrowserModule.withServerTransition({ appId: 'serverApp' }),\n //BrowserTransferStateModule,\n BrowserAnimationsModule,\n MatMenuModule,\n MatButtonModule,\n MatIconModule,\n MatCardModule,\n MatTabsModule,\n MatSidenavModule,\n MatListModule,\n MatToolbarModule,\n MatInputModule,\n MatTableModule,\n MatPaginatorModule,\n MatSortModule,\n MatProgressSpinnerModule,\n MatDialogModule,\n AppRoutingModule,\n MatSelectModule,\n MatDatepickerModule,\n ReactiveFormsModule,\n HttpClientModule\n ],\n providers: [\n CoursesService,\n CourseResolver\n ],\n bootstrap: [AppComponent]\n})\nexport class AppModule {\n}\n\npackage.json\n{\n \"name\": \"angular-universal-course\",\n \"version\": \"0.0.0\",\n \"scripts\": {\n \"ng\": \"ng\",\n \"start\": \"ng serve\",\n \"build\": \"ng build\",\n \"test\": \"ng test\",\n \"lint\": \"ng lint\",\n \"e2e\": \"ng e2e\",\n \"serve:prerender\": \"http-server -c-1 dist/angular-universal-course/browser\",\n \"dev:ssr\": \"ng run angular-universal-course:serve-ssr\",\n \"serve:ssr\": \"node dist/angular-universal-course/server/main.js\",\n \"build:ssr\": \"ng build --configuration production && ng run angular-universal-course:server:production\",\n \"prerender\": \"ng run angular-universal-course:prerender --routes routes.txt\"\n },\n \"private\": true,\n \"dependencies\": {\n \"@angular/animations\": \"^16.0.0\",\n \"@angular/cdk\": \"^16.0.0\",\n \"@angular/common\": \"^16.0.0\",\n \"@angular/compiler\": \"^16.0.0\",\n \"@angular/core\": \"^16.0.0\",\n \"@angular/forms\": \"^16.0.0\",\n \"@angular/material\": \"^16.0.0\",\n \"@angular/platform-browser\": \"^16.0.0\",\n \"@angular/platform-browser-dynamic\": \"^16.0.0\",\n \"@angular/platform-server\": \"^16.0.0\",\n \"@angular/router\": \"^16.0.0\",\n \"@nguniversal/express-engine\": \"^16.0.0\",\n \"@types/express\": \"^4.17.8\",\n \"express\": \"^4.15.2\",\n \"rxjs\": \"~7.8.0\",\n \"tslib\": \"^2.3.0\",\n \"zone.js\": \"~0.13.0\"\n },\n \"devDependencies\": {\n \"@angular-devkit/build-angular\": \"^16.0.0\",\n \"@angular/cli\": \"^16.0.0\",\n \"@angular/compiler-cli\": \"^16.0.0\",\n \"@nguniversal/builders\": \"^16.0.0\",\n \"@types/jasmine\": \"~3.8.0\",\n \"@types/jasminewd2\": \"~2.0.3\",\n \"@types/node\": \"^14.15.0\",\n \"http-server\": \"^14.0.0\",\n \"jasmine-core\": \"~3.8.0\",\n \"jasmine-spec-reporter\": \"~5.0.0\",\n \"karma\": \"~6.3.2\",\n \"karma-chrome-launcher\": \"~3.1.0\",\n \"karma-coverage-istanbul-reporter\": \"~3.0.2\",\n \"karma-jasmine\": \"~4.0.0\",\n \"karma-jasmine-html-reporter\": \"^1.5.0\",\n \"ts-node\": \"~8.3.0\",\n \"typescript\": \"~5.0.4\"\n }\n}"}
+{"id": "000009", "text": "When implementing a ControlValueAccessor I need to dynamically display some content based on whether or not the control is required. I know I can do this to get the control:\nreadonly #control = inject(NgControl, {self: true})\nprotected parentRequires = false\n\nngOnInit(): void {\n this.#control.valueAccessor = this\n\n this.parentRequires = this.#control.control?.hasValidator(Validators.required) ?? false\n}\n\nbut that only checks to see if it's currently required. What I am not seeing though is how to detect changes. The parent is going to toggle the required attribute on/off based on other actions in the application.\nI'm looking for something like the non-existent this.#control.control.validatorChanges"}
+{"id": "000010", "text": "I try to get sorted data from MatTableDataSource using this code:\nthis.source = this.dataSource.sortData(this.dataSource.filteredData,this.dataSource.sort);\n\nbut I got this error:\n\nArgument of type 'MatSort | null' is not assignable to parameter of type 'MatSort'.Type 'null' is not assignable to type 'MatSort\n\nI am using Angular 16."}
+{"id": "000011", "text": "So I just updated my project from Angular v15 to v16, and suddenly I get a lot of missing imports errors thrown, such as error NG8001: 'mat-icon' is not a known element but I have imported everything accordingly to documentation in my app.module.ts:\nimport {MatIconModule} from '@angular/material/icon';\n\n@NgModule({\n declarations: [...],\n imports: [..., MatIconModule, ...],\n bootstrap: [AppComponent],\n})\nexport class AppModule {}\n\nOr am I missing something in my package.json? I have tried to update everything according to docs:\n \"dependencies\": {\n \"@angular-devkit/core\": \"^16.2.0\",\n \"@angular-devkit/schematics\": \"^16.2.0\",\n \"@angular/animations\": \"~16.2.1\",\n \"@angular/cdk\": \"^16.2.1\",\n \"@angular/common\": \"~16.2.1\",\n \"@angular/compiler\": \"~16.2.1\",\n \"@angular/core\": \"~16.2.1\",\n \"@angular/forms\": \"~16.2.1\",\n \"@angular/material\": \"^16.2.1\",\n \"@angular/platform-browser\": \"^16.2.1\",\n \"@angular/platform-browser-dynamic\": \"~16.2.1\",\n \"@angular/router\": \"~16.2.1\",\n \"bootstrap\": \"^4.4.1\",\n \"moment\": \"^2.26.0\",\n \"popper.js\": \"^1.16.0\",\n \"rxjs\": \"^6.5.5\",\n \"tslib\": \"^2.0.0\",\n \"xstate\": \"~4.6.7\",\n \"zone.js\": \"~0.13.1\"\n }\n\nI tried deleting node_modules folder and reinstalling, running npm install, and npm ci but nothing has worked till now. I only find the tip to add the missing module to app.module.ts but I have this already, has anyone also run into this problem and found a solution?"}
+{"id": "000012", "text": "I just did import { OrderModule } from 'ngx-order-pipe'; in app.module.ts and added it in imports\n imports: [BrowserModule, OrderModule,...],\n\nand when I did ng serve, I am getting below failed to compile error"}
+{"id": "000013", "text": "Let me preface this question with the fact that I started learning Angular about a month ago.\nBasically, I have a searchbar component and several different itemcontainer components (each of them displays a different type of item). In an attempt to have access to the serchbar value on any component, I created a searchbarService like so:\nimport { Injectable, signal, WritableSignal } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SearchBarService {\n\n searchTextSignal: WritableSignal = signal('');\n\n setSearch(text: string): void{\n this.searchTextSignal.set(text);\n }\n}\n\nThe searchbar component calls the setSearch method on input submit. So far so good. Now, the problem comes when trying to work with searchTextSignal on the itemcontainter components. I'm trying to use it like this:\nimport { Component, signal} from '@angular/core';\nimport { Factura } from 'src/app/interfaces/factura';\nimport { FacturaService } from 'src/app/services/factura.service'; //gets items from a placeholder array.\nimport { SearchBarService } from 'src/app/services/search-bar.service';\n\n@Component({\n selector: 'vista-facturas',\n templateUrl: './vista-facturas.component.html',\n styleUrls: ['./vista-facturas.component.css']\n})\nexport class VistaFacturasComponent {\n\n facturasArray: Factura[] = []; // has all items\n filteredFacturasArray = signal([]); // has all filtered items, and is the value that I want to get updated when the signal changes.\n\n constructor(private facturaService: FacturaService, public searchBarService: SearchBarService) { }\n\n getFacturas(): void { //initializes the arrays.\n this.facturaService.getFacturas().subscribe(facturasReturned => this.facturasArray = facturasReturned);\n this.filteredFacturasArray.set(this.facturasArray);\n }\n\n filterFacturas(): void{ // this method is likely the problem\n\n let text = this.searchBarService.searchTextSignal();\n\n if (!text) \n this.filteredFacturasArray.set(this.facturasArray);\n \n this.filteredFacturasArray.set(this.facturasArray.filter(factura => factura?.numero.toString().includes(text)));\n }\n\n ngOnInit(): void {\n this.getFacturas();\n }\n}\n\n\nThe templace uses ngFor like so:\n
\n
\n \n
\n
\n\nSo, everything boils down to how to make VistaFacturasComponent call filterFacturas() when searchBarService.searchTextSignal() updates. Any ideas?"}
+{"id": "000014", "text": "I have created a custom ui library using only standalone components and here's my public-api.ts file.\n/*\n * Public API Surface of ih-ui-lib\n */\n\nexport * from './lib/ui-lib.service';\nexport * from './lib/ui-lib.component';\nexport * from './lib/ui-lib.module';\n\n// Exporting components\nexport * from './lib/components/card/card.component';\nexport * from './lib/components/card/card-heading/card-heading.component';\nexport * from './lib/components/card/card-content/card-content.component';\nexport * from './lib/components/cards-responsive/cards-responsive.component';\nexport * from './lib/components/collapsible/collapsible.component';\nexport * from './lib/components/heading/heading.component';\nexport * from './lib/components/icon/icon.component';\nexport * from './lib/components/paragraph/paragraph.component';\nexport * from './lib/components/pill/pill.component';\nexport * from './lib/components/scrollbar/scrollbar.component';\nexport * from './lib/components/search/search.component';\nexport * from './lib/components/search/components/search-column/search-column.component';\nexport * from './lib/components/search/components/search-row/search-row.component';\nexport * from './lib/components/status-bar/status-bar.component';\nexport * from './lib/components/timeline/timeline.component';\n\n\nHere's a example of a component:\nimport { Component, Input, OnInit } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'card',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './card.component.html',\n styleUrls: ['./card.component.css']\n})\nexport class CardComponent implements OnInit {\n\n @Input() classes: string = '';\n @Input() width: string = '';\n @Input() radius: string = 'sm';\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n}\n\nHere's how I'm adding to my app's package.json\n \"ui-library\": \"git+repo+url.git#branch\",\n\nI also have index.ts file at the root of my lib which just exports the public-api.ts file so I can access it from the root.\nexport * from './dist/ih-ui-lib/public-api';\nI created a new standalone component in my app and tried to import that component into my app.\nAnd that is when I get this error:\nTypeError: Cannot read properties of undefined (reading '\u0275cmp')\nI'm using angular 16.\nI tried using modules for components and still it is the same.\nI tried importing standalone component to a module in my app and it failed to recognise that component."}
+{"id": "000015", "text": "I've updated my project to Angular 16. In app.module.ts, I have an array of components named entryComponents. However, the entryComponents is no longer available in Angular 16. Where should I add these components to my project:\nentryComponents:[\n PayResultDialogComponent,\n MessageBoxComponent\n ],"}
+{"id": "000016", "text": "After Angular CanActivate interface became deprecated, I've changed my guards for simple const functions based on official documentation.\nFor example here is my inverseAuthGuard method, which seems working correctly:\nexport const inverseAuthGuard = (): boolean => {\n const authService = inject(AuthService);\n const router = inject(Router);\n if (authService.isAuthenticated()) {\n router.navigate(['/visual-check']);\n return false;\n }\n return true;\n};\n\nMy problem is that, I want to write some unit tests for it and I don't know how can I inject a mock authService and a mockRouter into this function. I've watched this video, which explains how can I inject mock services into a class, but for my guard function I couldn't make it working.\nI have tried some ways, but I couldn' find any solution.\nIf I do this way:\n\ndescribe('InverseAuthGuard', () => {\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [HttpClientTestingModule, RouterTestingModule],\n providers: [\n { provide: AuthService, useValue: AuthService },\n { provide: Router, useValue: Router },\n ],\n });\n });\n\n fit('should return true on not authenticated user', () => {\n const result = inverseAuthGuard();\n expect(result).toBe(true);\n });\n});\n\nI've got the following error:\nNG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`\n\nIf I do that way, what I saw in the video:\ndescribe('InverseAuthGuard', () => {\n const setupWithDI = (authService: unknown, router: unknown) =>\n TestBed.configureTestingModule({\n providers: [\n { provide: AuthService, useValue: authService },\n { provide: Router, useValue: router },\n ],\n }).inject(inverseAuthGuard);\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [HttpClientTestingModule, RouterTestingModule],\n });\n });\n\n fit('should return true on not authenticated user', () => {\n const mockAuthService: unknown = { isAuthenticated: () => true };\n const mockRouter: Router = jasmine.createSpyObj(['navigate']);\n setupWithDI(mockAuthService, mockRouter);\n const result = inverseAuthGuard();\n expect(result).toBe(true);\n });\n});\n\nI've got the following error:\nNullInjectorError: No provider for inverseAuthGuard!\n\nOf course, I've tried providing inverseAuthGuard somehow, but without any success.\nI think there should be an easy solution for it, but I didn't find in any documentation. I will be thanksful for any answer."}
+{"id": "000017", "text": "My student is asking me : << why should I inject stuff inside the constructor instead of injecting directly in the attribute of the class ?\nWhat I teach to her :\nUse injection inside the constructor\nhousingLocationList: HousingLocation[] = [];\nhousingService: HousingService = inject(HousingService);\n\nconstructor() {\n this.housingLocationList = this.housingService.getAllHousingLocations();\n}\n\nWhat She wants to do :\nInject the housing service directly inside the class attribute\n@Component({\n//...\n})\nexport class HomeComponent {\n\n housingService: HousingService = inject(HousingService);\n housingLocationList: HousingLocation[] = this.housingService.getAllHousingLocations();\n \n constructor() {}\n}\n\nWhat should I answer to her ?\nWhat I tried :\nI tried to convice her that it's a dogma and she should not think about it and just do it like that :)\nWhat I expected :\nShe accept my answer\nWhat actually resulted:\nShe still wants to know"}
+{"id": "000018", "text": "I am trying to populate mat-table via dynamic data from an API.\nData is getting populated but pagenation part is unresponsive.\nI tried solutions provided in below links on Stackoverflow, non of them worked. I am using Angular 16 and angular material 16.2.10\nSolution1\nSolution2\nSolution3\nSolution4\nSolution5\nPFB my code:\nComponent.ts:\n\n\nimport { HttpClient } from '@angular/common/http';\nimport { Component, OnInit, ViewChild, AfterViewInit, ChangeDetectorRef } from '@angular/core';\nimport {MatPaginator, MatPaginatorModule} from '@angular/material/paginator';\nimport {MatTableDataSource, MatTableModule} from '@angular/material/table';\n\n@Component({\n selector: 'app-test-api',\n templateUrl: './test-api.component.html',\n styleUrls: ['./test-api.component.css'],\n standalone: true,\n imports: [MatTableModule, MatPaginatorModule]\n})\nexport class TestAPIComponent implements OnInit, AfterViewInit {\n public displayedColumns: string[] = ['id', 'name', 'email', 'city', 'latitude'];\n public getJsonValue: any;\n public dataSource: any = [];\n//code for pagination: tried all solutions from stackoverflow , none worked\n@ViewChild(MatPaginator) paginator: MatPaginator;\n //@ViewChild(MatPaginator, {read: true}) paginator: MatPaginator;\n \n /*@ViewChild(MatPaginator, {static: false})\n set paginator(value: MatPaginator) {\n this.dataSource.paginator = value;\n } */\n\n /*@ViewChild(MatPaginator) set matPaginator(mp: MatPaginator) {\n this.paginator = mp;\n this.dataSource.paginator = this.paginator;\n}*/\n \n constructor(private http : HttpClient){\n\n }\n ngOnInit(): void {\n this.getMethod();\n //this.cdr.detectChanges();\n }\n\n public getMethod(){\n this.http.get('https://jsonplaceholder.typicode.com/users').subscribe((data) => {\n console.table(data);\n console.log(this.paginator);\n this.getJsonValue = data;\n this.dataSource = data;\n //tried below code from stackoverflow but didn't work and commented ngAfterViewInit code\n this.dataSource.paginator = this.paginator;\n });\n \n }\n\n ngAfterViewInit() {\n //this.dataSource.paginator = this.paginator;\n } \n}\n\n\n\nHTML:\n\n\n
test-api works!
\n
Test API
\n\n\n
Test API: Dynamic
\n
dynamic-table works!
\n\n
\n
\n \n \n \n
Id
\n
{{element.id}}
\n \n \n \n \n
Name
\n
{{element.name}}
\n \n \n \n \n
email
\n
{{element.email}}
\n \n \n \n \n
city
\n
{{element.address.city}}
\n \n\n \n \n
Latitude
\n
{{element.address.geo.lat}}
\n \n \n
\n
\n
\n \n \n \n
\n \n\n\n\nCurrent Table UI with disabled pagination:"}
+{"id": "000019", "text": "I have this arrangement of the components, such that a component called landing-home.component loads another component client-registration-form.component using ViewContainerRef, on an , rendering on ngAfterViewInit.\nThe component client-registration-form.component represents a form with input fields. This component has a subject as\nmessageSource = new BehaviorSubject(new ClientRegistrationModel(..))\n\nwhich is the form's input data. I want to capture this data in the parent component landing-home.component.\nclient-registration-form.component.html\n
\n
\n First Name\n \n
\n \n
\n \n
\n
\n\nclient-registration-form.component.ts\nimport { Component, Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\nimport {ClientRegistrationModel} from '../models/client-registration.model';\n\n@Component({\n selector: 'app-client-registration-form',\n templateUrl: './client-registration-form.component.html'\n})\n@Injectable()\nexport class ClientRegistrationFormComponent {\n clientRegistrationMoel : ClientRegistrationModel = new ClientRegistrationModel(\"\",\"\",\"\",\"\");\n constructor() {}\n private messageSource = new BehaviorSubject(new ClientRegistrationModel(\"\",\"\",\"\",\"\"));\n public currentMessage = this.messageSource.asObservable();\n\n OnSubmit()\n {\n this.messageSource.next(this.clientRegistrationMoel);\n }\n}\n\nlanding-home.component.html\n
\n \n
\n\n\nlanding-home.component.js\nimport { Component, ViewChild, ViewContainerRef, Input, ChangeDetectorRef } from '@angular/core';\nimport {ClientRegistrationFormComponent} from '../client-registration-form/client-registration-form.component';\nimport {ClientRegistrationModel} from '../models/client-registration.model';\n\n@Component({\n selector: 'app-landing-home',\n templateUrl: './landing-home.component.html'\n})\n\nexport class LandingHomeComponent {\n @ViewChild('container', {read: ViewContainerRef}) container!: ViewContainerRef;\n constructor(private clientRegistrationFormComponent: ClientRegistrationFormComponent,\n private changeDetector: ChangeDetectorRef){}\n\n registrationDetails : ClientRegistrationModel = new ClientRegistrationModel('','','','');\n \n ngAfterViewInit()\n {\n // some condition\n this.container.createComponent(ClientRegistrationFormComponent);\n this.changeDetector.detectChanges(); \n }\n}\n\nWhat I am trying to achieve here is that I have a list of child components. Child component A, B, C etc. and a parent component P. The appropriate child will be loaded based on certain condition along with while loading the parent P. Now I want a way to transfer data such as form input (or may be just a boolean flag informing the parent that the form of the child is submitted successfully or failed over a REST call in the child) from the currently loaded child A or B or C.\nThe above code is just a try to find a way to do this and not necessarily has to follow the same structure but importantly I have a long list of child components and do not want to add those with *ngIf.\nLet me know if there is a better approach for such scenario."}
+{"id": "000020", "text": "I'm migrating from angular 16 to 17 and I encountered the issue that I need to replace all the usages of *ngFor and *ngIf and ngSwitch with the new syntax (@for and @if and @switch).\nI know the v17 still supports the old syntax but is there a way to migrate them or a regex to replace them with the new form?"}
+{"id": "000021", "text": "I am unable to add a scrollOffset option to my Angular 17 bootstrap config.\nBefore Angular 17, you'd have an app module that imports a routing module as such:\nimport { NgModule } from '@angular/core';\nimport { PreloadAllModules, RouterModule, Routes } from '@angular/router';\n\nconst routes: Routes = [\n {\n path: '',\n component: HomeComponent,\n },\n];\n\n@NgModule({\n imports: [\n RouterModule.forRoot(routes, {\n initialNavigation: 'enabledBlocking',\n scrollPositionRestoration: 'enabled',\n anchorScrolling: 'enabled',\n scrollOffset: [0, 100],\n preloadingStrategy: PreloadAllModules,\n }),\n ],\n exports: [RouterModule]\n})\nexport class AppRoutingModule { }\n\nIn Angular 17, you now pass a config object to the bootstrapApplication function, and I am unable to find a way to add the scrollOffset config as before (see above):\n// main.ts\n\nimport { bootstrapApplication } from '@angular/platform-browser';\nimport { appConfig } from './app/app.config';\nimport { AppComponent } from './app/app.component';\n\nbootstrapApplication(AppComponent, appConfig)\n .catch((err) => console.error(err));\n\n// app.config.ts\nimport { ApplicationConfig } from '@angular/core';\nimport { withInMemoryScrolling } from '@angular/router';\nimport { routes } from './app.routes';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideRouter(\n routes,\n withInMemoryScrolling({\n scrollPositionRestoration: 'enabled',\n anchorScrolling: 'enabled',\n }),\n //\u00a0Where can I put my scrollOffset???\n ),\n ],\n};"}
+{"id": "000022", "text": "I have an angular project using ng2-right-click-menu for context menu\nSince with Angular 16 its not compatible, i have to switch to an alternative solution\nWhen i searched for Angular material menu\n \n\ncame across Angular CDK menu.\nimport {CdkMenuModule} from '@angular/cdk/menu;\n\nConfused which one to use for my application.\nAs the menu should be customizable."}
+{"id": "000023", "text": "I\u2019m trying to use the new angular signal effect to listen on changes for a signal array of objects.\nBut the effect doesn\u2019t get called at any time.\nIt gets only called if I filter out one object of the array.\nPushing and updating an object of the array doesn\u2019t call the effect.\nHere\u2019s my code:\n// this code trigger the effect\ncase \"DELETE\":\n this.houses.update(((houses: House[]) => houses.filter((house: House) => house.id !== payload.old.id)));\n break;\n// this code doesn\u2019t trigger the effect\n case \"INSERT\":\n this.houses.update((houses: House[]) => {const updatedHouses = houses.push(payload.new); return updatedHouses;})\n break;\n\neffect(() => {\n this.filteredHouses = this.houses();\n this.onFilter();\n });\n\nObey of I reset the value of the signal and set the new value afterwards, the effect will be called. What am I doing wrong?"}
+{"id": "000024", "text": "Attempting to implement a guard with Okta authentication in Angular v17, I encountered an error indicating a lack of provider for the OktaAuthStateService.\nUpon logging in through Okta, I gain access to the login status component. However, when attempting to navigate to the dashboard using routes, I encounter an error related to the absence of a provider, specifically the OktaAuthStateService.\nauth.guard.ts\nimport { Router, UrlTree, } from '@angular/router';\nimport { Injectable } from '@angular/core';\nimport { OktaAuthStateService } from '@okta/okta-angular';\nimport { Observable, map, take } from 'rxjs';\n\n@Injectable({ providedIn: 'root' }) export class AuthGuard { constructor( public authStateService: OktaAuthStateService, private router: Router ) {}\n\ncanActivate(): Observable { \nreturn this.authStateService.authState$.pipe( map((loggedIn) => { console.log('loggedIn', loggedIn);\nif (!loggedIn) {\n this.router.navigate(['/login']);\n return false;\n }\n return true;\n }),\n take(1)\n);\n} }\n\napp.module.ts\n\nimport { NgModule } from '@angular/core';\nimport { AppComponent } from './app.component';\nimport { OktaAuthModule, OKTA_CONFIG } from '@okta/okta-angular';\nimport { OktaAuth } from '@okta/okta-auth-js';\nimport myAppConfig from './app.config';\nconst oktaConfig = myAppConfig.oidc;\nconst oktaAuth = new OktaAuth(oktaConfig);\n\n@NgModule({\ndeclarations: [],\nimports: [OktaAuthModule],\nproviders: [{ provide: OKTA_CONFIG, useValue: { oktaAuth } }],\nbootstrap: [AppComponent],\n})\nexport class AppModule {}\n\napp.routes.ts\n\nimport { Routes, mapToCanActivate } from '@angular/router';\nimport { OktaCallbackComponent, OktaAuthGuard } from '@okta/okta-angular';\nimport { LoginComponent } from './modules/auth/components/login/login.component';\nimport { AuthGuard } from './core/guards/auth.guard';\nimport { DashboardComponent } from './modules/pages/dashboard/dashboard.component';\nimport { LoginStatusComponent } from './modules/auth/components/login-status/login-status.component';\nimport { CommonGuard } from './core/guards/common.guard';\n\nexport const routes: Routes = [\n{\npath: '',\nredirectTo: 'login',\npathMatch: 'full',\n},\n{\npath: 'login',\ncomponent: LoginComponent,\n},\n{ path: 'login-status', component: LoginStatusComponent },\n{ path: 'implicit/callback', component: OktaCallbackComponent },\n{\npath: 'dashboard',\ncanActivate: mapToCanActivate([AuthGuard]),\ncomponent: DashboardComponent,\n},\n];"}
+{"id": "000025", "text": "Since angular now has stanalone components, how do we show one comonent inside another like we used to. e.g inside app body\nI dont have any idea about how standalone components work and i'm a fresher in angular just migrated from angular 12 to angular 17."}
+{"id": "000026", "text": "I am following the docs of angular from Angular Guard\nBelow is my Guest Guard Code. The logic is to check if the user is available or not,\nif available, redirect to dashboard else proceed to login page.\nimport { CanActivateFn } from '@angular/router';\nimport { Injectable } from '@angular/core';\n\n\n@Injectable()\n\nclass PermissionsService {\n canActivate(): boolean {\n return false;\n }\n\n}\n\nexport const guestGuard: CanActivateFn = (route, state) => {\n return inject(PermissionsService).canActivate();\n};\n\nBut this code throws error as\n[ERROR] TS2304: Cannot find name 'inject'. [plugin angular-compiler]\n\nsrc/app/guards/guest.guard.ts:15:13:\n 15 \u2502 return inject(PermissionsService).canActivate();"}
+{"id": "000027", "text": "I have been googling this an there are many versions, most are old.\nI have an angular 16 project which was not made with standalone components but I've created this 1 standalone component which I want to load as a dialog.\nMy question is, in angular 16, how do I go about loading a standalone component without the use of routing or preloading it?\nCan it be done?\nAny guidance would be appreciated as there's just too many versions on the internet."}
+{"id": "000028", "text": "Angular is failing to compile because of the following error and I'm really confused as to why.\nerror TS2322: Type 'string' is not assignable to type 'MenuItem'.\n\n4 \n ~~~~\n\n apps/angular-monorepo/src/app/app.component.ts:10:16\n 10 templateUrl: './app.component.html',\n ~~~~~~~~~~~~~~~~~~~~~~\n Error occurs in the template of component AppComponent.\n\nWhy is it complaining that item is of type 'string' when I specified that item is of type MenuItem or undefined\n@Component({\n standalone: true,\n imports: [NxWelcomeComponent, RouterModule, MenuItemComponent],\n selector: 'angular-monorepo-root',\n templateUrl: './app.component.html',\n styleUrl: './app.component.scss',\n})\nexport class AppComponent {\n title = 'angular-monorepo';\n menu: MenuItem[] = [\n {id: 101,category: 'appetizer', name:'french toast', price: 10.00},\n {id: 201,category: 'entree',sub_category:\"rice\",name:'pork', price: 10.00},\n {id: 301,category: 'drinks',name:'tea', price: 10.00},\n {id: 401,category: 'dessert',name:'affogato', price: 10.00},\n ]\n}\n//app.component.html\n\n
\n}\n\n\n//menu-item.type.ts\nexport type MenuItem = {\n id: number,\n category: ItemCategory,\n sub_category?: string,\n name: string,\n price: number\n }\n\nI expect item would be of type MenuItem like I specified"}
+{"id": "000029", "text": "Example:\nhttps://stackblitz.com/edit/myxj6y?file=src%2Fexample%2Fsnack-bar-overview-example.ts\nI tried the class in styles.scss, with ng-deep, overriding the component's root class and it still doesn't work. I'm not using standalone components. What is wrong with the code ?\n\"@angular/material\": \"^16.2.9\",\n\"@angular/common\": \"^16.2.0\","}
+{"id": "000030", "text": "I have updated my Angular app to version 16 and now in older browsers I am getting the error which says \"SyntaxError: private fields are not currently supported.\"\nI am trying to use polyfills to support modern browser features in the older browsers.\nHere is the polyfills.ts file:\nimport 'core-js';\nimport 'core-js/stable';\nimport 'regenerator-runtime/runtime';\n\nimport 'zone.js';\n\nThis is the tsconfig.json\n\"compilerOptions\": {\n \"target\": \"es2015\"\n },\n\nThis is the error on Firefox (v75):"}
+{"id": "000031", "text": "after migrating to new angular 17 and updating my template, ng serve throws this message\nNG5002: Cannot parse expression. @for loop expression must match the pattern \" of\n\""}
+{"id": "000032", "text": "I'm using Angular material's AutoComplete as follows\n \n\nThis is more or less a copy-past from one of their examples.\nBut what I would like to add is text above the options (inside the overlay) if there are no options (yet)\n@if(userCtrl.value?.length < 3) { \n
Type 3 or more characters
\n} @else if(isLoading) {\n
loading...
\n} @else if (!(filteredOptions | async)?.length) {\n
No match found
\n}\n\nHowever, the overlay is closed when there are 0 options. Is there a way, such that I can show/activate the overlay when the input has focus and 0 options (empty array)? But when the user select an options, the focus is lost and the overlay closes\nDEMO"}
+{"id": "000033", "text": "I'm developing a solution Angular 16 Material using the free theme Matero.\nI started from the downloadable demo so Angular Core ^16.2.7 etc.(https://github.com/ng-matero/ng-matero/blob/main/package.json), deleting the unuseful demo parts.\nI'm facing a problem with subscribing after a http call, i need to declare\n@Component({\n ...\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n\nin the constructor\nexport class LoginComponent {\n isSubmitting = false;\n ...\n constructor(\n ...\n private ref: ChangeDetectorRef,\n ) {}\n\nand finally after a call for example a login\n this.isSubmitting = true;\n this.auth\n .login(this.username.value, this.password.value, this.rememberMe.value)\n .pipe(filter(authenticated => authenticated))\n .subscribe({\n next: () => {\n this.isSubmitting = false; \n this.ref.markForCheck();\n },\n\nin the html for example a button\n\n\nWith the previous code, pratically it should happens nothing (there is no router redirection) but by clicking the button the spinner inside the button should cease to spin and appear back the \"Login\" text.\nBut this happens because the \"this.ref.markForCheck();\" otherwise without this call it ignores the change of isSubmitting and the spinner remain here.\nThe same for an http call ( normal call with HttpClient that returns an Observable) with binding to a mtx-grid, the binding succeed only by calling \"this.ref.markForCheck();\" in the \"subscribe\".\nAngular CLI is 16.2.10\nWhat i'm doing in a wrong manner ?"}
+{"id": "000034", "text": "The first step\n ng add @angular-eslint/schematics\n\nexecutes successfully but the second step\n ng g @angular-eslint/schematics:convert-tslint-to-eslint\n\nproduces this error:\n Error: The `convert-tslint-to-eslint` schematic is no longer supported.\n\n Please see https://github.com/angular-eslint/angular-eslint/blob/main/docs/MIGRATING_FROM_TSLINT.md\n\nand the readme document referenced in the error message is the one I was following to attempt this migration.\nI successfully used this schematic about about three weeks ago.\nHas anyone else encountered this error message? Know of a workaround?\nAngular CLI: 17.0.7\nNode: 18.13.0\nPackage Manager: npm 8.19.3\nOS: darwin x64\n\nAngular: 17.0.7\n... animations, cli, common, compiler, compiler-cli, core, forms\n... language-service, localize, platform-browser\n... platform-browser-dynamic, router\n\nPackage Version\n---------------------------------------------------------\n@angular-devkit/architect 0.1700.7\n@angular-devkit/build-angular 17.0.7\n@angular-devkit/core 17.0.7\n@angular-devkit/schematics 17.0.7\n@schematics/angular 17.0.7\nrxjs 7.8.1\ntypescript 5.2.2\nzone.js 0.14.2"}
+{"id": "000035", "text": "I have an Angular 17 application which uses standalone components, the initial routes are set up like so in app.routes.ts\nexport const appRoutes: Array = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n {\n path: 'login',\n component: LoginComponent,\n title: 'Login',\n },\n {\n path: '',\n canActivateChild: [AuthGuard],\n loadChildren: () => import(`./app-authorized.routes`).then((r) => r.appAuthorizedRoutes),\n },\n { path: '**', redirectTo: '/dashboard' },\n];\n\nOnce the user logs in they are authorized and redirected to /dashboard, and the app-authorized.routes.ts routes are loaded. Here is what that file looks like:\nexport const appAuthorizedRoutes: Array = [\n {\n path: 'dashboard',\n component: DashboardComponent,\n canActivate: [AuthGuard],\n title: 'Dashboard',\n },\n {\n path: 'settings',\n component: SettingsComponent,\n canActivate: [AuthGuard],\n title: 'Settings',\n },\n //etc...\n];\n\nAn issue I have is that after logging in, there is a delay as the data loads and the UI looks strange. I have a navigation bar set to appear when authorized, which shows but the login component is also still showing - which is wrong.\nAfter logging in and while the lazy-loaded chunks are loading, is there a way to display this progress in the UI somehow?"}
+{"id": "000036", "text": "I have an Angular 17 application using standalone components, the initial routes are set up like so in app.routes.ts\nexport const appRoutes: Array = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n {\n path: 'login',\n component: LoginComponent,\n title: 'Login',\n },\n {\n path: '',\n canActivateChild: [AuthGuard],\n loadChildren: () => import(`./app-authorized.routes`).then((r) => r.appAuthorizedRoutes),\n },\n { path: '**', redirectTo: '/dashboard' },\n];\n\nOnce the user logs in they are authorized and redirected to /dashboard, and the app-authorized.routes.ts routes are loaded. Here is what that file looks like:\nexport const appAuthorizedRoutes: Array = [\n {\n path: 'dashboard',\n component: DashboardComponent,\n canActivate: [AuthGuard],\n title: 'Dashboard',\n },\n {\n path: 'settings',\n component: SettingsComponent,\n canActivate: [AuthGuard],\n title: 'Settings',\n },\n //etc...\n];\n\nI have several services that can only be used once the user logs in, but currently upon inspecting the chunked files Angular loads, all of the services are loaded initially at the login page. Of course this makes sense because they are decorated with\n@Injectable({\n providedIn: 'root',\n})\n\nModules of course would make this easy, but since I'm not using modules how do I tell my application to include only certain services along with the lazy-loaded routes, or just any way after the user logs in?"}
+{"id": "000037", "text": "I am migrating old angular project to latest angular 17. I changed class based auth guard to functional auth guard. The problem I am having is that I get this error:\nERROR NullInjectorError: NullInjectorError: No provider for _UserService!\nat NullInjector.get (core.mjs:5626:27)\nat R3Injector.get (core.mjs:6069:33)\nat R3Injector.get (core.mjs:6069:33)\nat injectInjectorOnly (core.mjs:911:40)\nat \u0275\u0275inject (core.mjs:917:42)\nat inject (core.mjs:1001:12)\nat authGuard (auth.guard.ts:6:23)\nat router.mjs:3323:134\nat runInInjectionContext (core.mjs:6366:16)\nat router.mjs:3323:89\n\nHere is my authGuard code:\nimport {CanActivateFn, Router} from '@angular/router';\nimport {inject} from \"@angular/core\";\nimport {UserService} from \"../users/user.service\";\n\nexport const authGuard: CanActivateFn = (route, state) => {\n const userService = inject(UserService);\n const router = inject(Router);\n\n if (!userService.is_authenticated()) {\n router.navigate(['login', state.url]);\n return false;\n }\n return true;\n};\n\nHere is part of my UserService:\nimport {Injectable} from '@angular/core';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport {HttpClient} from '@angular/common/http';\n\n@Injectable()\nexport class UserService {\n private usersUrl = '/users/';\n\n constructor(private http: HttpClient,\n private jwtHelper: JwtHelperService) { }\n\n ...\n\n public is_authenticated(): boolean {\n const token = localStorage.getItem('token');\n // Check whether the token is expired and return\n // true or false\n return !this.jwtHelper.isTokenExpired(token);\n }\n}\n\nAs I understand the documentation I don't need to provide UserService anywhere. Using 'inject' should be enough. What am I doing wrong?"}
+{"id": "000038", "text": "I apologize in advance if i am asking too stupid questions but i am really new to angular and i do not understand how to handle a JSON object coming from the server and convert that object into a custom datatype so i can use that data to render on html using ngFor.\nI have tried multiple things but nothing seems to work. Any help will be very much appreciated.\nP.S. please excuse me for the extremely simple html page, application is coming up from scratch and i am working on functionalities and backend server connections before working on the designs.\nBelow is the Code and screenshots attached.\nEmployee.Component.html\n\n
Inside Employee Component.
\n\n\n
\n
Employee List
\n {{ employees }}\n
\n\nemployee.component.ts file\n\nemployees: any;\n\n constructor(private service: EmployeeServiceService){\n }\n ngOnInit(){\n\n }\n\n public getAllEmployees1(){\n this.service.getAllEmployees().subscribe((data)=>{\n\n this.employees = data;\n console.log(\"Response: \"+ this.employees);\n },\n (error) =>{\n console.error('Error fetching employees: ', error);\n }\n );\n }\n\nEmployeeService file:\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmployeeServiceService {\n\n constructor(private http:HttpClient) { }\n\n getAllEmployees(){\n console.log(\"Inside get ALL Employees Method.\");\n return this.http.get(\"https://localhost:9090/employee/getAllEmployees\",{responseType:'text' as 'json'});\n }\n\nEmployee class type:\n\nexport class AddEmployee{\n firstName: any;\n lastName: any;\n address:any;\n project:any\n ssn:any;\n joinDate:any;\n status:any\n\n constructor(\n firstName: string,\n lastName: string,\n address:string,\n project:string,\n ssn:number,\n joinDate:Date,\n status:number\n ){}\n }\n\nI wanted to convert the JSON data coming from the server to AddEmployee type and then run a ngFor loop in the html so i can put everything in the tabular format.\nBut angular keeps on complaining that the data i am getting is in Object Format and ngFor can only be used on observables and iterators. Below is the image attached of how the object gets pulled from server and when i click on getAllEmployees button, it just renders the object itself. I am not able to print the data if i dont call {{ employees }} directly.\nenter image description here\nError Page:"}
+{"id": "000039", "text": "I want to create a dynamic form that is an array of payments, the user can add a new payment, delete from the array, and edit.\nMy HTML:\n\n\nThe configuration of my component:\n@Component({\n selector: 'app-create-loan-dialog',\n standalone: true,\n imports: [\n MatInputModule,\n MatButtonModule,\n MatDialogTitle,\n MatDialogContent,\n MatDialogActions,\n MatDialogClose,\n ReactiveFormsModule,\n MatStepperModule,\n ],\n providers: [\n {\n provide: STEPPER_GLOBAL_OPTIONS,\n useValue: { showError: true },\n },\n ],\n templateUrl: './create-loan-dialog.component.html',\n})\n\nMy FormGroup:\ncreateLoanPaymentsForm: FormGroup = this.formBuilder.group({\n payments: this.formBuilder.array([]),\n});\n\nThere is an error in my loop, it says:\n\nType '{ [key: string]: AbstractControl; }' must have a 'Symbol.iterator' method that returns an iterator.\n\nThe solution for this bug, possible the correct configuration for a FormArray loop in Angular 17"}
+{"id": "000040", "text": "I recently Upgraded to Angular to V17 with SSR and when i tried to load page this error is coming. ERROR Error: NullInjectorError: No provider for SocialAuthServiceConfig!\nNote: - I am using Only standalone components (No modules)\nNeed help to resolve this issue\nERROR Error: NullInjectorError: No provider for SocialAuthServiceConfig!\n at t (angular/node_modules/zone.js/fesm2015/zone-error.js:85:33)\n at NullInjector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:5626:27)\n at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\n at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\n at injectInjectorOnly (angular/node_modules/@angular/core/fesm2022/core.mjs:911:40)\n at Module.\u0275\u0275inject (angular/node_modules/@angular/core/fesm2022/core.mjs:917:42)\n at initialState (angular/node_modules/@abacritt/angularx-social-login/fesm2022/abacritt-angularx-social-login.mjs:374:46)\n at eval (angular/node_modules/@angular/core/fesm2022/core.mjs:6189:43)\n at runInInjectorProfilerContext (angular/node_modules/@angular/core/fesm2022/core.mjs:867:9)\n at R3Injector.hydrate (angular/node_modules/@angular/core/fesm2022/core.mjs:6188:17)\n at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6058:33)\n at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\n at ChainedInjector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:15378:36)\n at lookupTokenUsingModuleInjector (angular/node_modules/@angular/core/fesm2022/core.mjs:4137:39)\n at getOrCreateInjectable (angular/node_modules/@angular/core/fesm2022/core.mjs:4185:12) {\n originalStack: 'Error: NullInjectorError: No provider for SocialAuthServiceConfig!\\n' +\n ' at t (angular/node_modules/zone.js/fesm2015/zone-error.js:85:33)\\n' +\n ' at NullInjector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:5626:27)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\\n' +\n ' at injectInjectorOnly (angular/node_modules/@angular/core/fesm2022/core.mjs:911:40)\\n' +\n ' at Module.\u0275\u0275inject (angular/node_modules/@angular/core/fesm2022/core.mjs:917:42)\\n' +\n ' at initialState (angular/node_modules/@abacritt/angularx-social-login/fesm2022/abacritt-angularx-social-login.mjs:374:46)\\n' +\n ' at eval (angular/node_modules/@angular/core/fesm2022/core.mjs:6189:43)\\n' +\n ' at runInInjectorProfilerContext (angular/node_modules/@angular/core/fesm2022/core.mjs:867:9)\\n' +\n ' at R3Injector.hydrate (angular/node_modules/@angular/core/fesm2022/core.mjs:6188:17)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6058:33)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\\n' +\n ' at ChainedInjector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:15378:36)\\n' +\n ' at lookupTokenUsingModuleInjector (angular/node_modules/@angular/core/fesm2022/core.mjs:4137:39)\\n' +\n ' at getOrCreateInjectable (angular/node_modules/@angular/core/fesm2022/core.mjs:4185:12)',\n zoneAwareStack: 'Error: NullInjectorError: No provider for SocialAuthServiceConfig!\\n' +\n ' at t (angular/node_modules/zone.js/fesm2015/zone-error.js:85:33)\\n' +\n ' at NullInjector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:5626:27)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\\n' +\n ' at injectInjectorOnly (angular/node_modules/@angular/core/fesm2022/core.mjs:911:40)\\n' +\n ' at Module.\u0275\u0275inject (angular/node_modules/@angular/core/fesm2022/core.mjs:917:42)\\n' +\n ' at initialState (angular/node_modules/@abacritt/angularx-social-login/fesm2022/abacritt-angularx-social-login.mjs:374:46)\\n' +\n ' at eval (angular/node_modules/@angular/core/fesm2022/core.mjs:6189:43)\\n' +\n ' at runInInjectorProfilerContext (angular/node_modules/@angular/core/fesm2022/core.mjs:867:9)\\n' +\n ' at R3Injector.hydrate (angular/node_modules/@angular/core/fesm2022/core.mjs:6188:17)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6058:33)\\n' +\n ' at R3Injector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:6069:33)\\n' +\n ' at ChainedInjector.get (angular/node_modules/@angular/core/fesm2022/core.mjs:15378:36)\\n' +\n ' at lookupTokenUsingModuleInjector (angular/node_modules/@angular/core/fesm2022/core.mjs:4137:39)\\n' +\n ' at getOrCreateInjectable (angular/node_modules/@angular/core/fesm2022/core.mjs:4185:12)',\n ngTempTokenPath: null,\n ngTokenPath: [\n '_SocialAuthService',\n '_SocialAuthService',\n 'SocialAuthServiceConfig',\n 'SocialAuthServiceConfig'\n ]\n}"}
+{"id": "000041", "text": "I am learning Angular multiple content projection from new Angular 17 docs.\nWhen I am using example from doc I am getting error:\nprofile.component.html::\n
\n \n
\n\n
\n \n
\n\n
\n \n
\n\nIn app.component.html::\n\n
Header 1
\n
This is projected content
\n\n\nI am getting this error::\nNG8001: 'profile-header' is not a known element:\n\nHow can I resolve it?"}
+{"id": "000042", "text": "Following is my Standalone api calls containing service:\n\n\nimport { Injectable} from '@angular/core';\nimport { ProductEndPoints } from '../../constants/apiConstants/product-endpoints';\nimport { HttpClient} from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { environment } from 'src/environments/environment.development';\nimport { product } from '../../models/product.types';\n@Injectable({\n providedIn: 'root',\n})\nexport class ProductService {\n\n constructor(private http:HttpClient) { }\n\n getAllProducts():Observable{\n return this.http.get(environment.apiUrl+`${ProductEndPoints.getAllProduct}`)\n }\n\n getProductDetailById(id:string):Observable{\n return this.http.get(environment.apiUrl+`${ProductEndPoints}/${id}`)\n }\n}\n\n\n\nI also added this service to target component's providers array.\nThe error I got while injecting it to the standalone component is :\nsrc_app_pages_Product_product-routing_ts.js:2 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(Standalone[ProductListComponent])[HttpClient -> HttpClient -> HttpClient -> HttpClient]: \n NullInjectorError: No provider for HttpClient!\nNullInjectorError: R3InjectorError(Standalone[ProductListComponent])[HttpClient -> HttpClient -> HttpClient -> HttpClient]: \n NullInjectorError: No provider for HttpClient!\n at NullInjector.get (core.mjs:8890:27)\n at R3Injector.get (core.mjs:9334:33)\n at R3Injector.get (core.mjs:9334:33)\n at R3Injector.get (core.mjs:9334:33)\n at R3Injector.get (core.mjs:9334:33)\n at ChainedInjector.get (core.mjs:14018:36)\n at lookupTokenUsingModuleInjector (core.mjs:4608:39)\n at getOrCreateInjectable (core.mjs:4656:12)\n at \u0275\u0275directiveInject (core.mjs:11801:19)\n at Module.\u0275\u0275inject (core.mjs:848:60)\n at resolvePromise (zone.js:1193:31)\n at resolvePromise (zone.js:1147:17)\n at zone.js:1260:17\n at _ZoneDelegate.invokeTask (zone.js:402:31)\n at core.mjs:10757:55\n at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:10757:36)\n at _ZoneDelegate.invokeTask (zone.js:401:60)\n at Object.onInvokeTask (core.mjs:11070:33)\n at _ZoneDelegate.invokeTask (zone.js:401:60)\n at Zone.runTask (zone.js:173:47)"}
+{"id": "000043", "text": "I'm quite new to Angular.\nI have this HTML file new-team.component.html:\n\n
\n
\n
\n
\n
\n New team creation\n
\n
\n \n
\n
\n
\n
\n
\n\nand this is my component file:\nimport { Component, OnDestroy, OnInit } from '@angular/core';\nimport { NgForm } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { Country } from 'src/app/_models/country.model';\nimport { CountryService } from 'src/app/_services/country.service';\nimport { User } from \"../../_models/user.model\";\nimport { AuthService } from \"../../_services/auth.service\";\n\n@Component({\n selector: 'app-new-team',\n templateUrl: './new-team.component.html',\n styleUrls: ['./new-team.component.scss']\n})\nexport class NewTeamComponent implements OnInit, OnDestroy {\n user!: User;\n countries: Country[] = [];\n AuthUserSub!: Subscription;\n\n constructor(\n private authService: AuthService,\n private countryService: CountryService\n ) {\n }\n ngOnInit(): void {\n\n this.AuthUserSub = this.authService.AuthenticatedUser$.subscribe({\n next: user => {\n if (user) this.user = user;\n }\n })\n\n this.countryService.getAllCountries().subscribe({\n next: data => {\n this.countries = data;\n this.countries.forEach(element => {\n element.logo = \"/assets/flags/\" + element.logo;\n });\n },\n error: err => console.log(err)\n })\n }\n\n onSubmitNewTeam(formNewTeam: NgForm) {\n console.log(formNewTeam);\n if (!formNewTeam.valid) {\n return;\n }\n }\n\n ngOnDestroy() {\n this.AuthUserSub.unsubscribe();\n }\n}\n\nOn the line where I call the console.log(formNewTeam); on my .ts file I just have the value of the input field, not the value selected into the .\nHow can I send these two values (input field + value of the ) to my backend API?\nBy the way, the Country object contains id, frenchName, and logo.\nI should receive the form with these two values for example: teamName = \"Real Madrid\" and countryId = \"10\"\nThank you in advance."}
+{"id": "000044", "text": "I am trying to work with AWS in angular but at the very start after I install AWS-SDK:\nnpm install aws-sdk\n\nAfter adding the below to my file-manager.ts, I am getting errors regarding node and stream.\nimport * as aws from 'aws-sdk';\n\nI added the following as suggested buy the compiler:\nTry `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.\n\nand still getting so many errors."}
+{"id": "000045", "text": "I am trying to build Angular 17 application with SSR, using built in i18n mechanism. And I don't get how to configure it to work together.\nv17 is brand new and there are blank spaces in documentation and not a lot of examples over the Internet.\nWhen creating simple application with Angular+SSR it creates server.ts alongside base application\n// imports\n\n// The Express app is exported so that it can be used by serverless Functions.\nexport function app(): express.Express {\n const server = express();\n const serverDistFolder = dirname(fileURLToPath(import.meta.url));\n const browserDistFolder = resolve(serverDistFolder, '../browser');\n const indexHtml = join(serverDistFolder, 'index.server.html');\n\n const commonEngine = new CommonEngine();\n\n server.set('view engine', 'html');\n server.set('views', browserDistFolder);\n\n // Example Express Rest API endpoints\n // server.get('/api/**', (req, res) => { });\n // Serve static files from /browser\n server.get('*.*', express.static(browserDistFolder, {\n maxAge: '1y'\n }));\n\n // All regular routes use the Angular engine\n server.get('*', (req, res, next) => {\n const { protocol, originalUrl, baseUrl, headers } = req;\n\n commonEngine\n .render({\n bootstrap,\n documentFilePath: indexHtml,\n url: `${protocol}://${headers.host}${originalUrl}`,\n publicPath: browserDistFolder,\n providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],\n })\n .then((html) => res.send(html))\n .catch((err) => next(err));\n });\n\n return server;\n}\n\nfunction run(): void {\n const port = process.env['PORT'] || 4000;\n\n // Start up the Node server\n const server = app();\n server.listen(port, () => {\n console.log(`Node Express server listening on http://localhost:${port}`);\n });\n}\n\nrun();\n\n\nand after building the app it creates the following structure in dist folder:\n# simple-ssr\n\n* [browser/](./simple-ssr/browser)\n * [first/](./simple-ssr/browser/first)\n * [index.html](./simple-ssr/browser/first/index.html)\n * [home/](./simple-ssr/browser/home)\n * [index.html](./simple-ssr/browser/home/index.html)\n * [second/](./simple-ssr/browser/second)\n * [index.html](./simple-ssr/browser/second/index.html)\n * [favicon.ico](./simple-ssr/browser/favicon.ico)\n * [index.html](./simple-ssr/browser/index.html)\n * [main-OUKHBY7S.js](./simple-ssr/browser/main-OUKHBY7S.js)\n * [polyfills-LZBJRJJE.js](./simple-ssr/browser/polyfills-LZBJRJJE.js)\n * [styles-Y4IFJ72L.css](./simple-ssr/browser/styles-Y4IFJ72L.css)\n* [server/](./simple-ssr/server)\n * [chunk-53JWIC36.mjs](./simple-ssr/server/chunk-53JWIC36.mjs)\n * ... other chunks\n * [index.server.html](./simple-ssr/server/index.server.html)\n * [main.server.mjs](./simple-ssr/server/main.server.mjs)\n * [polyfills.server.mjs](./simple-ssr/server/polyfills.server.mjs)\n * [render-utils.server.mjs](./simple-ssr/server/render-utils.server.mjs)\n * [server.mjs](./simple-ssr/server/server.mjs)\n* [3rdpartylicenses.txt](./simple-ssr/3rdpartylicenses.txt)\n* [prerendered-routes.json](./simple-ssr/prerendered-routes.json)\n\n\nrunning node dist/simple-ssr/server/server.mjs starts the Express server and everything works fine.\nThe problem starts after adding Angular built-in i18n.\nAfer seetting up everything and localizing the app it works okay with ng serve.\nBut building dist version it generates another nested structure:\n# simple-ssr-with-i18n\n\n* [browser/](./my-app/browser)\n * [en-US/](./my-app/browser/en-US)\n * [assets/](./my-app/browser/en-US/assets)\n * [img/](./my-app/browser/en-US/assets/img)\n * [first/](./my-app/browser/en-US/first)\n * [index.html](./my-app/browser/en-US/first/index.html)\n * [home/](./my-app/browser/en-US/home)\n * [index.html](./my-app/browser/en-US/home/index.html)\n * [second/](./my-app/browser/en-US/second)\n * [index.html](./my-app/browser/en-US/second/index.html)\n * [favicon.ico](./my-app/browser/en-US/favicon.ico)\n * [index.html](./my-app/browser/en-US/index.html)\n * [main-VKL3SVOT.js](./my-app/browser/en-US/main-VKL3SVOT.js)\n * [polyfills-LQWQKVKW.js](./my-app/browser/en-US/polyfills-LQWQKVKW.js)\n * [styles-UTKJIBJ7.css](./my-app/browser/en-US/styles-UTKJIBJ7.css)\n * [uk/](./my-app/browser/uk)\n * [assets/](./my-app/browser/uk/assets)\n * [img/](./my-app/browser/uk/assets/img)\n * [first/](./my-app/browser/uk/first)\n * [index.html](./my-app/browser/uk/first/index.html)\n * [home/](./my-app/browser/uk/home)\n * [index.html](./my-app/browser/uk/home/index.html)\n * [second/](./my-app/browser/uk/second)\n * [index.html](./my-app/browser/uk/second/index.html)\n * [favicon.ico](./my-app/browser/uk/favicon.ico)\n * [index.html](./my-app/browser/uk/index.html)\n * [main-VKL3SVOT.js](./my-app/browser/uk/main-VKL3SVOT.js)\n * [polyfills-LQWQKVKW.js](./my-app/browser/uk/polyfills-LQWQKVKW.js)\n * [styles-UTKJIBJ7.css](./my-app/browser/uk/styles-UTKJIBJ7.css)\n* [server/](./my-app/server)\n * [en-US/](./my-app/server/en-US)\n * [index.server.html](./my-app/server/en-US/index.server.html)\n * [main.server.mjs](./my-app/server/en-US/main.server.mjs)\n * [polyfills.server.mjs](./my-app/server/en-US/polyfills.server.mjs)\n * [render-utils.server.mjs](./my-app/server/en-US/render-utils.server.mjs)\n * [server.mjs](./my-app/server/en-US/server.mjs)\n * [uk/](./my-app/server/uk)\n * [index.server.html](./my-app/server/uk/index.server.html)\n * [main.server.mjs](./my-app/server/uk/main.server.mjs)\n * [polyfills.server.mjs](./my-app/server/uk/polyfills.server.mjs)\n * [render-utils.server.mjs](./my-app/server/uk/render-utils.server.mjs)\n * [server.mjs](./my-app/server/uk/server.mjs)\n* [3rdpartylicenses.txt](./my-app/3rdpartylicenses.txt)\n* [prerendered-routes.json](./my-app/prerendered-routes.json)\n\nfolder structure for i18n & ssr\nObviously pathes in server.ts and, as a result, in dist/simple-ssr-with-i18n/server/en-US/server.mjs are not set up right for working correctly with different locale versions.\nAnd as I imagined it should work simply with following changes\n const languageFolder = basename(serverDistFolder);\n const languagePath = `/${languageFolder}/`;\n const browserDistFolder = resolve(\n serverDistFolder,\n '../../browser' + languagePath\n );\n\nand running separate express server instance for each locale. (Ideally one server serving all locales, of course)\nBut all of my attempts were not successful, running node dist/simple-ssr/server/server.mjs leads to unresponsive site with errors fetching static .js file chunks.\nMay somebody provide some comprehensive example for server.ts and setting up i18n+ssr together?\nOnly relible article I found is Angular-universal-and-i18n-working-together\nbut it's outdated, and i get built-time errors on baseHref step.\nP.S. Chatgpt is aware of Angular 15 and Universal, so it's not also very helpfull."}
+{"id": "000046", "text": "We are trying to implement deferrable views for a component in angular. This component is present in a component which is used by a parent in another repo. While defer seems to be working when we implemented it inside component of the same project, its not working when imported and used in a library. Two issue here actually:\n\ncode is not split into a new bundle but loaded along with the main library bundle\nplaceholder element appears for a split second and then the view disappears. on checking the html i found that I cannot see the child elements of the deferred component, its just like a dummy element\n\n\nHere are the things which I have followed as a requirement:\n\nUsing angular 17 in both the main project and library project\nUsing on viewport condition to defer the block\nthe component inside the defer block is a standalone component\ncomponent is not used anywhere outside the defer block and also not referenced using viewchild\n\nIs there anything I'm doing wrong or any additional requirement I need to follow ?"}
+{"id": "000047", "text": "I have this\n