Skip to content

Instantly share code, notes, and snippets.

@troygoode
Last active August 29, 2015 14:12
Show Gist options
  • Save troygoode/91f386f6e20f264539be to your computer and use it in GitHub Desktop.
Save troygoode/91f386f6e20f264539be to your computer and use it in GitHub Desktop.
Reflux helper
//= require ../../app
(function () {
'use strict';
angular
.module('analytics_v2')
.directive('activities', function (ActivityActions, ActivityStore, RefluxDirectiveHelper) {
return {
restrict: 'A',
templateUrl: '/analytics_v2/directives/activities/activities.html',
compile: function () {
return {
pre: function (scope) {
scope.loading = true;
var unlisten = ActivityStore.listen(function () {
scope.loading = ActivityStore.loading;
scope.activities = ActivityStore.activities;
scope.$digest();
});
scope.refresh = function () {
ActivityActions.load();
};
scope.$on('$destroy', function () {
// dispose of action listeners
unlisten();
});
}
};
}
};
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment