Destroy a hook
import { CounterState, CounterStore } from 'counter-store';
function YourController($scope: ng.IScope, counterStore: CounterStore) {
const hookLink = counterStore.hook('INCREMENT_COUNT', (state) => {
$scope.count = state.count;
if ($scope.count === 10) {
hookLink.destroy();
}
});
}
angular
.module('App', [])
.controller('YourController', YourController);import { CounterState, CounterStore } from 'counter-store';
function YourController($scope: ng.IScope, counterStore: CounterStore) {
counterStore.hook('INCREMENT_COUNT', (state) => {
$scope.count = state.count;
}).destroyOn($scope);
}
angular
.module('App', [])
.controller('YourController', YourController);Last updated
Was this helpful?