Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. $scope.items = [{id:1,type:apple},{id:2,type:banana},{id:3,type:mango}]
  2.  
  3. <div ng-repeat="item in items">
  4. <my-item item-type="{{item.type}}"></my-item>
  5. </div>
  6.  
  7. function () {
  8. function resolveTemplate(element, attrs) {
  9. var itemType = '';
  10. if (itemType === 'apple') {
  11. return 'apple.html';
  12. } else {
  13. return 'default.html';
  14. }
  15. }
  16. return {
  17. restrict: 'E',
  18. templateUrl: resolveTemplate,
  19. link: function (scope, element, attrs) {
  20. // nothing here
  21. }
  22. };
  23. }
  24.  
  25. scope: {
  26. 'itemType': '@'
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement