Created
October 31, 2013 16:46
-
-
Save Greenie0506/7252973 to your computer and use it in GitHub Desktop.
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
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