Questions tagged state

Explore the latest questions and answers asked by our top developers.

How to correctly go to state url using AuthGuardService

I am having trouble navigating to the state url after login. Here is my AuthGuardService canActivate func: async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { sessionStorage.setItem(‘routeAfterLogin’, state.url); let auth: boolean = true; this.authService.isAuthorized().subscribe(authorized => { if (!authorized) { this.authService.login(); } auth = authorized; }) return auth; } and then I’m getting the saved state url in app.component.ts […]

Navigating on the same page with NgRx Router Store

I am currently building an application using NgRx and the Router Store. There is a dropdown in one component, that changes params in the url and navigates on the same component. Since navigating on the same component doesn’t call NgOnInit the corresponding effect (that calls the API) is not called. In my opinion, the effect […]

By Manox
Published
Categorized as angular, navigation, ngrx, state Tagged , , ,

AngularJS: TypeError: Cannot set property ‘accountTypeName’ of undefined

I’m building a form in angularjs to allow a user to create an account – this involves selecting a value from a lookup but I am getting the following error when I try and select an option from this: TypeError: Cannot set property ‘accountTypeName’ of undefined at CreateAccountController.selectAccountTypeName (create-account.component.ts:24) My html code is as follows: […]

By smose
Published
Categorized as angularjs, state Tagged ,

How are NgRx Selectors and Reducers pure functions?

According to the NgRx documentation Reducers and Selectors are pure functions. "Reducers are pure functions in that they produce the same output for a given input." "Because selectors are pure functions, the last result can be returned when the arguments match without reinvoking your selector function." Consider the following simple example export const AppState = […]

By Devesh Pradhan
Published
Categorized as angular, ngrx, pure-function, state Tagged , , ,

NGXS State shared children

I am having a problem , I have two portals , two states SMS and Email state They both have to use the CommunicationFilterState and CommunicationRecipientsState The two above are two different states which are passed as @State<SmsSettingsModel>({ name: ‘smsSettings’, defaults: { id: null, name: null, type: null, status: null, eventId: null, communicationFilter: { filters: […]

By Ady Kazuke
Published
Categorized as angular, frontend, ngxs, state, typescript Tagged , , , ,

Angular Dynamically created component are not maintaining their state

I’m trying to dynamically create multiple components which will be placed in a table. The current code achieves this goal, however reference to state seems to get messed up at the dynamically created component level. So when a component is clicked and we look inside the click handler, within the dynamically generated component, this.data shows […]

Angular component rerenders but it shouldnt

I have written my self a service, that provides an observable, that observers the media breakpoints and returns a value depending on the breakpoint. In my angular component I am calling a method with parameters in order to change the span of a column depending on screen breakpoint. The subscription function only fires when the […]

Angular component with observable rerender issue

I have written my self a service, that provides an observable, that observers the media breakpoints and returns a value depending on the breakpoint. In my angular component I am calling a method with parameters in order to change the span of a column depending on screen breakpoint. The subscription function only fires when the […]

Store pattern for game state in angular

I’m working on a web game built in Angular, using WebSockets to communicate to the backend. So far I’ve decided that the clients send "events" as needed, and the server sends back the "state", 10 times a second or so. On the client side, this is handled by a ConnectionService that components can consume. This […]

By yathern
Published
Categorized as angular, rxjs, state, store Tagged , , ,

Unable to patch the state with update to the store using NGXS. I keep seeing type error: cannot freeze

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 using NGXS to store the auth related items like tokens, user info etc. import { State, […]

By RawCode
Published
Categorized as angular, angular11, javascript, ngxs, state Tagged , , , ,
1 3

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