Last active
August 29, 2015 14:12
-
-
Save troygoode/91f386f6e20f264539be to your computer and use it in GitHub Desktop.
Reflux helper
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
//= 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