Issue I have this setup for a number of components: @Directive() export abstract class BaseComponent implements OnInit { @Select(PortalState.portal) public portalState: Observable<PortalModel>; public portal: PortalModel; protected ngUnsubscribe: Subject<void> = new Subject(); constructor( protected someService: SomeService, protected route: ActivatedRoute ){ }
Continue readingTag: ngxs
NativeScript Importing NGXS module in app.module throw an error in log console
Issue I’m new with NativeScript and I want to use a state management NGXS and implement to my app. I have installed NGXS with NPM: @ngxs/store @ngxs/logger-plugin and @ngxs/devtools-plugin. So I added those NGXS module to my app.module. import {
Continue readingElement implicitly has an 'any' type because expression of type '"_popupComponentRef"' can't be used to index type 'MatDatepicker<Date>'
Issue They gave me this error : Element implicitly has an ‘any’ type because expression of type ‘"_popupComponentRef"’ can’t be used to index type ‘MatDatepicker’. Property ‘_popupComponentRef’ does not exist on type ‘MatDatepicker’ Please Help me with this problem. On
Continue readingNGXS global state's slices emit on every navigation
Issue After tracking down unexpected requests being made I’ve found that my app’s global user state’s slices emit upon every navigation. What are potential causes of an NGXS state slice emitting where its data hasn’t changed and actions have not
Continue readingHow to apply updateItem to multiple/all items in Ngxs?
Issue I need an alternative to change the same attribute, with the same value, for all items in an array in Ngxs. I tried to use updateItem(() => true, patch({ … })), but it doesn’t work because the first function,
Continue readingNgXs @selector doesn't support async functions
Issue Inside my NGXS store I have the following async selector @Selector() static async mainState(store: IMyStore): Promise<IMyState> { return this.getActiveState(store); } If I now subscribe to this selector @Select(MyStore.mainState) state$: Observable<IMyState>; If I subscribe to this stream I receive promises
Continue readingNgXs @selector doesn't support async functions
Issue Inside my NGXS store I have the following async selector @Selector() static async mainState(store: IMyStore): Promise<IMyState> { return this.getActiveState(store); } If I now subscribe to this selector @Select(MyStore.mainState) state$: Observable<IMyState>; If I subscribe to this stream I receive promises
Continue readingNgxs – How do I chain actions?
Issue I want to do something like this for my registration. When clicking the register button, this will be executed: this.store.dispatch(new Register(user)) .subscribe(response => { localStorage.setItem(‘token’, JSON.stringify(response.token)); let redirectUrl = this.store.dispatch(new RegisterSuccess(response)); if (redirectUrl) { this.router.navigate([redirectUrl]); } else { this.router.navigate([‘/home’]);
Continue readingCORS is somehow stopping my Angular and Nestjs apps from communicating
Issue I’m building an app with Angular and NestJS using NGXS for state management. I got everything set up and served my application and got this error in the console. Access to XMLHttpRequest at ‘localhost:333/api/product-index’ from origin ‘http://localhost:4200‘ has been
Continue readingHow can I listen to multple actions in NGXS?
Issue I’m in the process of converting an application from NgRX to NgXs. In NgRx, I could ‘listen’ to multiple actions in an effect and react appropriately to them. How can I accomplish this using NgXS? In NgRx, I may
Continue readingWith NGXS, what is the recommended way of calling the backend before calling the local state
Issue I’m starting a new angular app and doing the setup for the team. One thing I’m wondering: where do you put the logic to access the backend? In my (first) case, about the accounts/auth, I need to store, username/email/accessToken,
Continue readingNgx-toastr, Unable to focus on it
Issue I have purchased this theme for angular and they have changed the default view of ngx-toastr. Everything is working fine but they have disabled focus on toast because of that I can’t perform any kind of action on it.
Continue readingHow to use NGXS Select() in an angular component
Issue I’ve an angular project with NGXS that I just setup. In my AuthState, I’ve the following: @Injectable() export class AuthState { @Selector() static isAuthenticated(state: AuthStateModel) { return state.currentUser !== null; } //… } In a component, I’m doing the
Continue readingNGXS Forms – How to handle nested form components
Issue I’ve got a user profile form with multiple steps, i.e. a wizard. On Submit/Save, the entire user profile form has to be submitted to an API I’m using NGXS and NGXS Forms. At the moment I have implemented the
Continue readingAppending Data to State in Angular NGXS
Issue I have a problem on how will be i able to append new datas since I’m making a server side scrolling. The posts is removing the old data when the new data arrives BUT i just want the new
Continue readinghow to use value from NGXS store in HttpInterceptor?
Issue I’m pretty new to Angular. I am using Angular 6 with NGXS for state management. My NGXS store has a user reducer whose interface is /* src/app/store/models/user.model.ts */ export interface User { serverToken? : string; // and other unrelated
Continue readingTwo Models in Angular for Passing & Display Data
Issue I have a problem with using models in ngxs. I have to use different model for passing data to api and getting data from the api I have a Report model and NetIncome model basically. How will i able
Continue readingNGXS Error: Can't resolve all parameters for TranslationEditorState: (?)
Issue I’m using NGXS for state management in Angular 9 application. In one of the state classes, any dependency injection causes an error “Error: Can’t resolve all parameters for TranslationEditorState: (?).” I’ve tried injecting a service and even the HttpClient,
Continue readingAngular upgrade from 8 to 9, Can't resolve all parameters for any injectable
Issue I recently upgrade form Angular 8 to Angular 9 and it appears that nothing can be dependency injected. I’ve commented out so much code in my project to something as basic as the following: // configuration.state.ts @State<ConfigurationStateModel>({ name: ‘ConfigurationStateModel’,
Continue readingSeeing this error in console log using ngxs store. "Error ocurred while serializing the store value, value not updated"
Issue Affected Package The issue is caused by package @ngxs/storage-plugin/fesm5/ngxs-storage-plugin.js Description I am using ngxs store in my angular application for storage management. Recently I am seeing below weird console error in my browser when I switch between various angular
Continue readingofActionSuccessful Return True Even When Have Errors in Angular NGXS
Issue I have a problem when i try to edit my user. I’ve decided to fetch again all the users after successfully updated it. However if there is an error i don’t want the form to reset and the modal
Continue readingWhat is state management in angular? and why should I use it?
Issue I am new to Angular and this question might be very broad. But I am interested in learning more on State management usage. Recently one of our project implemented state management using NGXS library. However I am trying to
Continue readingUnsubscribing in Angular NGXS
Issue I’m new to NGXS in Angular and I have read that you don’t need to unsubscribe when you use the async pipe. However I’m also subscribing from the queryParams and I’m subscribing from the dispatches action. Do I need
Continue readingNGXS Actions Observable Jest Expectation
Issue Im currently facing a strange Behavior. When I want to run multiple expectations on the store state after successful finishing the Store Action I’m unable to observe the reason of test failure. If all expectations are met, the test
Continue readingUnable to patch the state with update to the store using NGXS. I keep seeing type error: cannot freeze
Issue I’m working with a basic Angular 11 application which has authentication implemented (using AWS Cognito & Amplify). What I’m trying to do here is quite simple. I am using builtin AWS Amplify methods to do the authentication. I am
Continue readingDeleting an object of a nested data in Angular using NGXS
Issue I have successfully implemented the get and delete function of post in my Angular app. My problem comes when you wanted to delete a comment inside a post. I’m trying to achieve it using NGXS. How will i be
Continue readingDeleting an object in Angular NGXS
Issue I have a problem deleting a comment on my post. How would you do it? I’m using the Angular NGXS state management. Pls see this link CLICK THIS LINK onDeleteComment(commentId: number){ this.store.dispatch(new DeleteComment(commentId)); } @Action(DeleteComment) deleteComment( ctx: StateContext<PostStateModel>, {
Continue readingAccess Nested Object Inside Array in Angular NGXS
Issue I have successfully implemented the delete comment function in my Angular app. My problem now is on the liking function of the comment. How do i implement the like function. I have the variable is_liked to determine if its
Continue reading