ngrx/data – alternate id `has a missing or invalid entity key (id)`

As there are many IDs in the system, my entities linked to database tables and the tables use ‘DbId’ as the primary key – instead of the ngrx/data default: ‘id’. That is addressed inside the EntityMetadata map by the property: selectId. All appears working fine, except when adding records to db table. The addition to […]

By Felix
Published
Categorized as angular, angular-ngrx-data, ngrx Tagged , ,

How to convert Angular jasmine test using testbed into jest?

In my Angular project i am switching to jest. Previously i had a test which is just checking that the DialogService.open method was called once const fixture = TestBed.createComponent(AppComponent); fixture.componentInstance.openSettingsModal()(); expect((<Spy>TestBed.inject(DialogService).open.mock).calls.length).toBe(1); now when switching to jest, i cannot do that anymore, because mock does not exist in the jest context. Is there anything simmiliar? TBH […]

By Felix
Published
Categorized as angular, jasmine, jestjs Tagged , ,

Angular 13 – own built libraries and nested sub-libraries and their paths

After researching the topic including many contradicting and often not working tutorials the simplest solution for nested sub-library was to follow the doc of ng-packagr All appears working fairly simply if the positioning of the config. files is correct as per the documentation. Here is the working arrangement of an own sample library with sub-library. […]

By Felix
Published
Categorized as angular Tagged

Angular 13 – own built libraries with nested sub-libraries, their paths and dependencies

After researching the topic including many contradicting and often not working tutorials the simplest solution for nested sub-library was to follow the doc of ng-packagr All appears working fairly simply if the positioning of the config. files is correct as per the documentation. Here is the working arrangement of an own sample library with sub-library. […]

By Felix
Published
Categorized as angular Tagged

Angular 13 creating library as per documentation fails on lint

While learning the new Angular 13 approach to creating libraries and following their documentation here all goes as described up to the step of: ng lint my-lib These steps are taken and the error appears at the end: An unhandled exception occurred: Project target does not exist. Cannot find "lint" target for the specified project. […]

By Felix
Published
Categorized as angular Tagged

how to populate css grid with array of data – column by column, not row by row using css styles [duplicate]

Say we have an array of [1,2,3,4,5,6,7,8,9,10] The below code renders it like this: 1 | 2 | 3 4 | 5 | 6 7 | 8 | 9 10 How do we render it like this? 1 | 4 | 7 | 10 2 | 5 | 8 | 3 | 6 | 9 […]

By Felix
Published
Categorized as angular, css, html Tagged , ,

Generic @ngrx/data service extending EntityCollectionServiceBase

Is it a viable option to implement a generic @ngrx/data service, such as: import { Injectable } from ‘@angular/core’; import { EntityCollectionServiceBase, EntityCollectionServiceElementsFactory } from ‘@ngrx/data’; @Injectable({providedIn: ‘root’}) export class NgRxDataService<T> extends EntityCollectionServiceBase<T> { constructor(entityName: string, serviceElementsFactory: EntityCollectionServiceElementsFactory) { super(entityName, serviceElementsFactory); } } … and use it with multiple pre-set data type objects / entities […]

By Felix
Published
Categorized as angular, ngrx, ngrx-data Tagged , ,

Mat-Form-field

Name display nothing on browser

By Felix
Published
Categorized as Uncategorized

How to assign async const to object’s property in typescript / javascript

In the following example I am trying to assign async const functions as Promises to a property of a parent object, so it could be lazily accessed in further code, such as the fn: async function getItem() in the example. But when assigning the const-s to the property ‘subItems’ I am getting error: Type ‘ItemI’ […]

By Felix
Published
Categorized as angular, javascript, typescript Tagged , ,

Webstorm Angular and Jest correctly add custom matcher with typings

How to fix my custom matcher so that WebStorm will not complain about types (Wallaby can run the test. See attached image): There is a custom matcher (with typings, setup-test.ts): toContainHeaders: (actual: TestRequest, expected: Record<string, string>) => { let message = ”; const result = Object.keys(expected).every(requiredHeader => { const headerPresent = actual.request.headers .keys() .some(header => […]

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq