Skip to content

Unsubscribe automatically $onDestroy #194

Open
@nico1510

Description

@nico1510

Just a quick question/RFC:

If you look at the react-redux source code you see that they unsubscribe from the store when the component is unmounted (https://github.com/reactjs/react-redux/blob/master/src/components/connectAdvanced.js#L168). The user doesn't have to remember to always include the unsubscribe when the component is destroyed. Would that be possible for angularjs too ? Like adding something like the following:

target.$onDestory = (() => {
  unsubscribe();

  target.$onDestory();
})(); 

to https://github.com/angular-redux/ng-redux/blob/master/src/components/connector.js#L58 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions