Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:23
    Fedejp commented #557
  • 18:23
    Fedejp commented #557
  • Aug 31 14:49
    SlaySayto commented #563
  • Aug 17 00:43
    YoanDesforges commented #549
  • Aug 10 16:58
    khlevon98 commented #388
  • Aug 05 14:47
    butlermd commented #388
  • Aug 05 14:46
    butlermd commented #388
  • Feb 27 09:44
    saravanakumar-sudo commented #428
  • Feb 19 03:57
    maplion commented #562
  • Jan 24 01:02
    arkD commented #566
  • Jan 23 21:31
    arkD edited #566
  • Jan 23 21:31
    arkD edited #566
  • Jan 23 21:31
    arkD edited #566
  • Jan 23 21:30
    arkD edited #566
  • Jan 23 21:30
    arkD edited #566
  • Jan 23 21:30
    arkD opened #566
  • Dec 12 2019 11:02
    s-uds closed #565
  • Dec 12 2019 11:02
    s-uds commented #565
  • Dec 11 2019 19:14
    s-uds opened #565
  • Nov 28 2019 21:06
    maheshnvv commented #142
Matthew Bonig
@mbonig
even if I supply a value="all" to the mat-radio-group element, I see the error
Matthew Bonig
@mbonig
I've tried it with v6.7.0-1 and 6.6.0
any help is appreciated..
Matthew Bonig
@mbonig
I got this working using a different method, using the sub-form approach detailed at the bottom of this page: https://github.com/angular-redux/form
but it feels bad since this violates the html
Jan Brodhäcker
@derBwody_twitter
hey all, I am trying to use the redux-dev tools trigger some actions - as stated in this article (https://medium.com/@zalmoxis/improve-your-development-workflow-with-redux-devtools-extension-f0379227ff83) there is a chance to see the action creators directly within the dev tools. But in all examples the actions are exported as static functions, in my angular application I am using an @Injectable, which can not be passed to devTools.enhancer(). Any clue about how this can work ?
CookieChar
@CookieChar

Hi@all, currently we're having some big trouble in our team using @angular-redux/store. We set up our store and everything went well (e.g. dispatching values into the store using epics) until we tried to access the store value. So we have the following situation:

  • There is a store-prop that contains an array of objects.
  • This prop gets its value after an action that is processed by an epic and so on... The action is triggered in the constructor of the same component that subscribes to its value. So we load the data from backend as soon as the belonging page is opened.
  • We're trying to access this value using
           this.ngRedux.select<SomeModel[]>(['path','to','value']).subscribe( (arrayFromStore) => { this.localComponentProp = arrayFromStore;} );
  • The problem is that subscribe is fired 2-times:
    1st time -> this.localComponentProp is an empty array with length == 0
    2nd time -> this.localComponentProp is NOT empty but length == 0
    We checked that logging them to the console.

We tried nearly everything but didn't get it to work... Hope someone has hint for us :)

Philip Da Silva
@rpdasilva
@CookieChar When you say the second time your subscribe fires, this.localComponentPropis not empty, but has a length of 0,
Just what is the value of this.localComponentProp?
CookieChar
@CookieChar
@rpdasilva Thanks for your reply!
The value at this time is actually the expected array returned from backend (and pushed into by the epic and the following success-action). Ironically when I test for the array length it still 0 :(
Philip Da Silva
@rpdasilva
@CookieChar Interesting. How are you actually asserting or testing for the length of the array?
CookieChar
@CookieChar
@rpdasilva In the common way... Just like resultArray.length > 0 :-/
Philip Da Silva
@rpdasilva

@CookieChar A better way to phrase my question may be where and then more importantly when are you checking/asserting the length of the array? Is it in a subscribe,

this.ngRedux.select<SomeModel[]>(['path','to','value']).subscribe(arrayFromStore => console.log(arrayFromStore.length))

Or based on that assignment you're doing, somewhere in your component template?
<div *ngIf="localComponentProp.length > 0">...</div>

Or are you trying to test that this.localComponentProp is correctly receiving array data in a spec file or something?

CookieChar
@CookieChar
Like you mentioned in your first example -> inside of the subscribe. So we're trying to check if the returned array has a length greater than 0 and if so, we're going to generate a table of the received data...
It seems like the store in the first moment returns the initial value of it (which would be []) but in the meantime, while logging it out to console, there is another dispatch/event and the array gets filled with the expected values - but that change doesn't arrive to the array length....
@rpdasilva
Philip Da Silva
@rpdasilva
@CookieChar Would you mind posting that code snippet so I can take a look?
Yosh
@yohannpoli
Any best practices about where i have to configure a store? At moment i used a StoreModule constructor, but it seem that i can't use APP_INITIALIZER with it (construct call before), should i use a service? any advice?
Ronn
@ronnross

I just started a Angular 4 project with redux yesterday. I'm pulling down redux 3.7.2, and notices that the typings for the Action interface only includes type: string. I have to react my own interface that looks like so

interface Action {
  type: string,
  payload?: any
}

Before I got everything to work. I must be not understand something because most the tutorials say to just import Action from redux.

Can someone point me in the right direction?
Ronn
@ronnross
this is their interface from redux's typings
export interface Action {
  type: any;
}
I don't see one with payload in the whole file.
Philip Da Silva
@rpdasilva
@ronnross redux only enforced a type property on the Action interface. You can certainly import and extend the interface to suit your purposes, or alternatively you can take a look at this project here: https://github.com/redux-utilities/flux-standard-action/blob/master/README.md
Ronn
@ronnross
@rpdasilva thanks!
Jan-Erik Lysander
@janeriklysander
@ronnross One advice from me (now regretting not going this way myself) is to look into ngrx as an alternative while working with Angular.
Pavel Šindelka
@pavel-sindelka

Hello guys, how I can parse class method with dispatch decorator as function parameter like this?

   @dispatch()
    createFilter = (formValues) => {
        const params = {
            ...this.searchFormData,
            ...formValues,
            filterAlertEnabled: !R.isNil(formValues.filterAlertEnabled)
        };

        return this.filtersActions.createFilter(params);
    };
<form class="dialog-content"
      id="search_filter_create"
      [formGroup]="filterSaveForm.formGroup"
      (ngSubmit)="filterSaveForm.submit(createFilter)"
>
submit = (success, error?) => {
        this.isValid()
            ? success(this.getValue())
            : error();
    };

this throw error: ERROR TypeError: Cannot read property 'constructor' of undefined

Gordon T Cumming
@DynamiteTom
He used the console.log with a + instead of a comma
console.log(' xxxx ', obj);
CookieChar
@CookieChar
Hello guys! Is there an example for using connectArray with reactive forms? :)
muneebejazz
@muneebejazz
hi
is this what i have to use instead of ng2-redux or is there any other library for statemanagement in angular. i am new to angular to help plz. thanks.
Ryan Dammrose
@maplion
Hi, I am trying to compile an rxjs-6-compatible version of @angular-redux/forms since the fix that is committed to the master branch hasn't been released yet. My issue is that I am uncertain on how I am supposed to build the project or what is used to build it and npm install throws an error when it runs > @angular-redux/form@9.0.0 build C:\git\third-party\form > ngc => source/connect/connect-base.ts(15,25): error TS1005: 'from' expected.
pookdeveloper
@pookdeveloper
Helllou
I have a reducer with many actions, and ia have a this constructor to get the values:
constructor(private store: Store<any>) {
    this.store.select('reducersInicio').subscribe(data => {
      console.log("Result --> ", data);
    });
  }
But depends on the action the result is diferent:
Result --> {numero: 15}
Result --> {data: true}
how can i map or filter to get only data or numero ?
i try this but nor work:
 constructor(private store: Store<any>) {
    this.store.select('reducersInicio').map(numero => {
      console.log("Result --> ", numero);
    });
  }
Ryan Dammrose
@maplion

@pookdeveloper With limited knowledge of what you're trying to do, I think you just need a condition in your current code to achieve your goal as well as a subscription, something like:

 constructor(private store: Store<any>) {
    this.store.select('reducersInicio').map(result => {
      if (typeof(result) === "boolean") {
           result = { data: result }
       } else if (typeof(result) === "number")) {
           result = { numero: result }
       }
    }).subscribe(result => {
         if (result.data) {
             console.log("data --> ", result);
         } else if (result.numero) {
              console.log("numero --> ", result);
         }
    });
  }

Note that you will need to use .pipe(map()) and not .map() if you're using Angular 6.
On an aside, it is my recommendation that you use the @selectannotation instead of injecting the store (e.g. make a variable in your class, like @select(['path', 'to', 'partial', 'store', 'object']) getStoreObject: Observable<anInterfaceRepresentingTheLevelOfMyObject>; and then subscribe to that variable this.getStoreObject.map(...).subscribe(...) ).

pookdeveloper
@pookdeveloper
thank @maplion you I'll review that
pookdeveloper
@pookdeveloper
Its recomend to defined a reducer with return Type? like this
image.png
Mustafa Zaki
@mustafazaki
how to add a callback in dispatch
this.ngRedux.dispatch
 addCourse(addCourse) {
        this.courseService.addCourse(addCourse).subscribe(course => {
            this.ngRedux.dispatch({
                type: ADD_COURSE,
                course,
            });
        });
    }
Ryan Dammrose
@maplion
@mustafazaki if you're trying to add callbacks to your dispatches, you're doing it wrong. Redux is uni-directional, so once you dispatch, you're done. You should have an observable tied to your redux store and have whatever needs it subscribed to it and it will send you the change based on your dispatched action and the change the store that your reducer does that reacts to that action.
The circle looks like: Component reads from redux store (with a subscription to an observable) => Component makes a call to a service => service dispatches an action => reducer that is listening for that action does something and changes the store => the change in the store fires the observable subscription => component reads new data from the store
precious Iyeritufu
@donprecious
image.png

Good Day All
am having issues with @select from ng2-redux here is the component

import { IAppState } from './../../redux/store';
import { Component, OnInit } from '@angular/core';
import { select } from 'ng2-redux';

@Component({
  selector: 'app-nav-bar',
  templateUrl: './nav-bar.component.html',
  styleUrls: ['./nav-bar.component.css']
})
export class NavBarComponent implements OnInit {

  @select( (a: IAppState) => a.isSignedIn) isSignedIn;
  constructor() { }

  ngOnInit(): void {
    console.log("is logged in object", this.isSignedIn)
  }
}

and here is the view , in which i want to use isSignedIn property

<a routerLink='/upload' class="uk-button uk-button-primary uk-button-small" >{{isSignedIn | async}}</a>
```

<a routerLink='/upload' class="uk-button uk-button-primary uk-button-small" >{{isSignedIn | async}}</a>
but i get this error ERROR TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
please can some one assit me
Barak Inbal
@BrkCoder
@smithad15 Hey can I help in maintain this library? I am an experienced angular developer which ready to help !!