ng-redux icon indicating copy to clipboard operation
ng-redux copied to clipboard

Can't use ES6 classes for actions

Open bensgroi opened this issue 8 years ago • 2 comments

The project I'm working on is written in ES6 and transpiled with babel. I can use classes for components just fine, but when attempting to use classes for actions and supply them to $ngRedux.connect, I get the following error: "'mapStateToScope' must return an object or a function. Instead received %s."

The check in question is here: https://github.com/angular-redux/ng-redux/blob/master/src/components/connector.js#L84 Specifically the lodash isPlainObject seems to be the problem. It seems like using isObject would make more sense here, and would allow transpiled ES6 classes as well.

I can submit a PR if you'd like.

bensgroi avatar May 26 '17 15:05 bensgroi

I'll try putting together a plunker or other demo.

bensgroi avatar May 26 '17 15:05 bensgroi

@bensgroi if you can submit a PR, that'd be great! I'm guessing this works correctly in plain redux?

AntJanus avatar Sep 13 '17 18:09 AntJanus