Git Product home page Git Product logo

angular2-redux's People

Contributors

micha149 avatar rubyboy avatar tuizi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular2-redux's Issues

how to use middleware

I like the "pure" approach of angular2-redux. Thank you for the effort...

Is it possible to use middleware with angular2-redux?

It would be convenient to have a little example how to do this...

AoT compiling not working

Hi,
I got a question regarding AoT compiling an app using the angular2-redux package. JiT compiling works for my Ionic2 app, but the AoT compiling used for the "ionic build ios" is not working. If I create the AppStore in app.module.ts as in your package example

export const appStoreFactory = createAppStoreFactoryWithOptions({ reducers, additionalMiddlewares: [], debug: true });
providers: [ {provide: AppStore, useFactory: appStoreFactory }]

then JiT compiling works, but AoT compiling throws the following error:

Error: Error encountered resolving symbol values statically. Calling function
'createAppStoreFactoryWithOptions', function calls are not supported. Consider replacing the function or
lambda with a reference to an exported function, resolving symbol appStoreFactory in
/Users/luki/work/kunden/valtech/bmg/mybmg-mobileapp/git/mybmg-mobileapp/.tmp/app/app.module.ts, resolving
symbol AppModule in

If I change the "appStoreFactory" to a function as follows:

export function appStoreFactory () { return createAppStoreFactoryWithOptions({ reducers, additionalMiddlewares: [], debug: true }); }

then the AoT is working (JiT is not working like this) but I get the following error in Xcode Debug when I start the app on my iPhone, that is catched in the catch part of my this.platform.ready() promise:

2016-11-23 19:02:04.933 myBMG[5739:2741555] reject: TypeError: t.appStore.select is not a function. (In 't.appStore.select(c.b)', 't.appStore.select' is undefined)
2016-11-23 19:02:04.937 myBMG[5739:2741555] reject: TypeError: t.appStore.dispatch is not a function. (In 't.appStore.dispatch(t.userActions.alreadyLoggedIn())', 't.appStore.dispatch' is undefined)

Any ideas about using angular2-redux with AoT ?
Thanks a lot for your help!

v5+ changes interface

Hi there,

I'm upgrading an older application from Angular 4. In the upgrade from 5 to 6 I needed to upgrade RxJS. angular2-redux makes this change in v5, but I'm finding that this breaks every use of the store.select function in the application. Higher versions don't fix this. It seems that when you pass function in as the keyOrSelector, when it it called you actually get the store object, not the state. Screenshot of dev tools showing this below.

angular2-redux

Your angular2-redux-example still uses v4 but as far as I can tell you are using selects there the same way we are. I'm surprised this hasn't been a reported issue before, but can't see that I'm doing anything wrong. Somehow the change between 4 to 5 to upgrade RxJS to 6 seems to have caused this.

Hope you can help

Wondering if I should use ng2-redux?

Just wondering why you didn't use the: https://github.com/wbuchwalter/ng2-redux
is there a benefit to your redux wrapper?

also see here at bottom:
zalmoxisus/redux-devtools-extension#43 (comment)

also I think you will be intersted in this:
zalmoxisus/redux-devtools-extension#44

basically they just released a new version of the DevTool with time travel.. sweet...
but with ng2 since it does not refresh, there is a bug, so they asked from Redux team that we apply a fix to your demo app with zone.run() or ApplicationRef.tick() to force update on UI changes AFTER store has updated when time traveling...
regards

Sean

Documention of "unsubscribe"?

From my point of view, It would a good idea to document how to subscribe / unsubscribe correctly or at least mention that it is necessary.

e.g in a component:

import {AppStore} from 'angular2-redux';

/**
 * Base Component which manages redux store with implementing lifecycle methods
 */
export class StateAwareComponent implements OnDestroy {

    appStoreDisposer: Function;

    constructor(public appStore: AppStore) {
        this.appStoreDisposer = appStore.subscribe(state => {
            this.handleStateSubscription(state);
        });
    }

    handleStateSubscription(state: any): void {
        console.error('handleState method not implemented');
    }

    ngOnDestroy() {
        console.log('destroy called');
        this.appStoreDisposer();
    }
}

Install of version 5.0.2 does not work

I did an fresh install for version 5.0.2. After that the build process says "Cannot find module 'angular2-redux'"

Also the artefacts landed in node_modules don't look like a lib.

Package usage - dist with .ts files

Hi, I've just tried to use angular2-redux package and for me it works only after removing all .td files from dist catalog. Otherwise TypeScript try to compile original files and then it's not possible to use it without errors. I use webpack with tsconfig.json like this :

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true
  },
  "exclude": [
    "node_modules",
    "typings/main.d.ts",
    "typings/main"
  ],
  "awesomeTypescriptLoaderOptions": {
    "resolveGlobs": true,
    "forkChecker": true
  },
  "compileOnSave": false,
  "buildOnSave": false
}

How to include the package?

Hello I would like to start using angular2-redux.

So in my System.config() I have:

paths: {
    "npm:*": "node_modules/*"
},
map: {
    "angular2-redux": "npm:angular2-redux/dist/index.js"
}

To be able to do:
import {AppStore, createAppStoreFactory} from "angular2-redux";

But I got this error:
angular2-polyfills.js:332 Error: SyntaxError: Unexpected token <
Evaluating http://localhost:3000/node_modules/angular2-redux/dist/app-store
Error loading http://localhost:3000/app/main.js

i know I forgot something, but was is the best way to fix that?

The new "select" method doesn't work well with the dev tools extension

The "select" method doesn't work when the dev tools extension is enabled (https://github.com/zalmoxisus/redux-devtools-extension).

You can see that by adding the following line into the AppComponent of the example app in the project:

      appStore.select((state)=>state).subscribe((state)=>console.log(state));
      // this won't work. Looking at the object outputted above shows why
      appStore.select("counter").subscribe((counter)=>console.log("counter",counter));

You need to have the extension installed (otherwise, it won't enable it)

Argument of type '{}' is not assignable to parameter of type 'ReducersMapObject'.

Hi guys,

I'm trying to use this library but after installing typings, when i try to run tsc it gives me the following errors:

node_modules/angular2-redux/dist/app-store-factory.ts(49,45): error TS2345: Argument of type '{}' is not assignable to parameter of type 'ReducersMapObject'.
  Index signature is missing in type '{}'.
node_modules/angular2-redux/dist/app-store-factory.ts(54,58): error TS2339: Property 'default' does not exist on type 'IMiddleware<any>'.
node_modules/angular2-redux/dist/app-store-factory.ts(55,57): error TS2339: Property 'default' does not exist on type 'IMiddleware<any>'.
node_modules/angular2-redux/dist/app-store-factory.ts(62,31): error TS2346: Supplied parameters do not match any signature of call target.

Also when I install my typings I get the following warning:

typings WARN badlocation "github:andrew-w-ross/typings-redux" is a mutable location and may change, consider specifying a commit hash

Any idea on what solutions there are for this?
Thanks

debug flag question

Hi! me again

I'm having troubles with that debug flag...
when I navigate to another route it dissapear (as espected)
I know there are workarrounds but it just doesn't feel right to put that query param everywhere...

is it possible to set the isDebug flag with an optional parameter in the createAppStoreFactory?
something like

export function createAppStoreFactory(reducers, additionalMiddlewares = [], shouldDebug?: boolean) {
    return () => {
            const isDebug = shouldDebug && window["devToolsExtension"];
    ....

or maybe checking for the global development mode

I also think it's better if the user can't just add 'debug' in the url and access that extra info

thanks for your time!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.