I created a component and I need to have two different templates depending on some condition. For example, I have a "testApp" component and if condition is true, the parent tag needs to be an anchor tag, otherwise parent tag has to be a div. The html content inside the parent container will be the same inside both templates. I am trying to figure out a way to do this, but I cannot find how and where to write the condition to choose the template.
angular.module('testApp').component('testCard', {
templateUrl: 'testCard', // inlined template
controller: [TestCardController]
});
<script type="text/ng-template" id="testCard">
<div class="test-card">
// same content
</div>
</script>
<script type="text/ng-template" id="testCard">
<a class="test-card">
// same content
</a>
</script>