Skip to content

Instantly share code, notes, and snippets.

@Greenie0506
Created October 31, 2013 16:46
Show Gist options
  • Save Greenie0506/7252973 to your computer and use it in GitHub Desktop.
Save Greenie0506/7252973 to your computer and use it in GitHub Desktop.
Here is the view:
<div ng-repeat="action in actions | filter:presentableAction" ng-include="templateForAction( action )"></div>
This is the filter:
$scope.presentableAction = function( action ) {
var presentable = false;
switch( action.action_type ) {
case 'like':
case 'watch':
case 'react':
presentable = true;
break;
}
return presentable;
}
This is what decides what template to render:
$scope.templateForAction = function( action ) {
return ( '/app/views/activity_stream/' + action.action_type + '.html' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment