Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.items = [{id:1,type:apple},{id:2,type:banana},{id:3,type:mango}]
- <div ng-repeat="item in items">
- <my-item item-type="{{item.type}}"></my-item>
- </div>
- function () {
- function resolveTemplate(element, attrs) {
- var itemType = '';
- if (itemType === 'apple') {
- return 'apple.html';
- } else {
- return 'default.html';
- }
- }
- return {
- restrict: 'E',
- templateUrl: resolveTemplate,
- link: function (scope, element, attrs) {
- // nothing here
- }
- };
- }
- scope: {
- 'itemType': '@'
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement