Within the Angular controller, there is a variable that contains the following:
$scope.items = [
{ title: 'x', type: 'x'},
{ title: 'y', type: 'y'}
];
Currently, there are only 2 items in the array, but there will be more added in the future. To display this array in HTML, I plan on using the ng-repeat Angular directive. However, I am facing a challenge: I need to render a different HTML tag based on the type of each item. For items with type 'x', I need to render <x-tag>
, and for items with type 'y', I need to render <y-tag>
. How can I achieve this? Any help is greatly appreciated!