My original code is difficult to debug and maintain, so I’m rewriting my code. Original Code this.userService.getLocationId(id).subscribe( (locationId) => { this.userService.getUserParams(locationId).subscribe( (params) => { // This API would store users to Akita Store this.userService.getUsers(params).subscribe() // Get data from Akita Store this.users$.subscribe( (users) => { this.users = […users] this.userService.putSomeUserFirst().subscribe( (data) => { if (data === true) ..
Category : angular-akita
I’m using Akita entity data stores to cache data on the front end of an Angular application. In my service I have some functions something like this: setPropertyOfEntity(entityId, newValue): void { store.update(entityId, {propertyName: newValue}); this.saveEntity(store.getEntity(entityId)); } saveEntity(entity) { httpClient.put(url, entity).subscribe((savedEntity) -> { store.upsert(savedEntity.id, savedEntity) }); } Now, understandably, the Akita store kicks out a whole ..
I have question about save different store state between views. I want to save active records for some entity but with distinction between which one was selected on particular views. Example Entity: id, name View 1 active: 1, 5 View 2 active: 2, 6 I tried to implement the dynamic stores and save all entities ..
I am trying to implement Akita entity store. But while the application will run, I cannot get the store to work and I get an error in the console when it tries to start the component. My error: ERROR Error: This constructor was not compatible with Dependency Injection. More Info: invalidFactory Angular Store_Factory datorama-akita.js:1101 ProductsStore_Factory ..
I have an angular frontend from which I access an asmx webservice. The respective class is marked as ScriptService and is generally able to return JSON (Post-request, Get will always return XML even with the respective ScriptMethod attributes (and empty body instead of null if no params)). Generally this works, but I’m not exactly getting ..
I am looking for any working example where I can save the search filter state after a click on the detail page and coming back to using the location.back() function. I am using the Akita store in my application to maintain the state. I was going through one of the AkitaFilter plugins but they are ..
I have an issue with my Angular10 application using Akita store. When I start/refresh my application on my component page I see LOADING on my component. However via the console it looks like the store has the items loaded and my console.logs are being triggered in the onInit. When I refresh the application on the ..
I have the next entity structure inside my Akita Store: { id: 1, values: [ {valueId: 1.1, data: [ {dataId: 1.3, text: ‘abc’}, {dataId: 1.4, text: ‘cba’} ]} ]; } I’m trying to add another Object to the data array of a specific value, for example I would like to add {dataId: 1.5, text: ‘dfg} ..
I have an Akita state set up… import { PhotosRootObject } from ‘../Interfaces/photos.int’; import { SearchRootObject } from ‘../Interfaces/search.photos.int’; export interface SessionState { data: PhotosRootObject[]; searchData: SearchRootObject; } export function createInitialState(): SessionState { return { data: null, searchData: null }; } @Injectable({ providedIn: ‘root’ }) @StoreConfig({ name: ‘session’ }) export class SessionStore extends Store<SessionState> { ..
It’s quite possible that I’ve set up my Akita store incorrectly but I have followed the docs pretty closely. I’m setting some routerLinks to populate dynamically from a store (app behavior depends on updating routes as a user navigates) Inside the subscription that returns the app state from which I derive my new routes, if ..
Recent Comments