While working in angular2, I came across a question regarding the usage of ngSwitch to load <div>
tag based on the datatype of a variable. Is it possible to achieve something like this:
<div [ng-switch]="value">
<p *ng-switch-when="isObject(value)">This is Object</p>
<p *ng-switch-when="isArray(value)">This is Array</p>
<p *ng-switch-when="isBoolean(value)">This is Boolean</p>
<p *ng-switch-when="isNumber(value)">This is Number</p>
<p *ng-switch-default>This is Simple Text !</p>
</div>
Can we actually load the div
tag based on the variable's datatype? If not, are there any potential workarounds for this scenario?