Last active
September 23, 2017 18:18
-
-
Save ball6847/0b994d8d68fdee251cbb23a3ce1783e4 to your computer and use it in GitHub Desktop.
Snippet for my Medium Article - 20170823
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* @ngInject */ | |
| export class MyComponent { | |
| constructor($scope: ng.IScope, $ngRedux: ngRedux.INgRedux) { | |
| const unsubscriber = $ngRedux.connect(state => state.myState)(this); | |
| // disconnect redux on component destroy | |
| $scope.$on('$destroy', unsubscriber); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment