Just diving into the world of Angular.JS and grappling with the concept of implementing ng-repeat.
Within my scope, I have a data object derived from JSON fetched from my database. Among the returned 'fields', one particular field can either be a single string or an array.
For instance:
Email Address = "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="117c7451657462653f727e7c">[email protected]</a>" or
Email Address = ["<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5e333b6f1e2a3b2d2a703d3133">[email protected]</a>", "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="670a025527130214134904080a">[email protected]</a>", "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d00085e2d19081e19430e0200">[email protected]</a>"]
What I want to achieve is to display whatever content the Email Address field holds within a series of spans. Here is what I've tried so far:
<span ng-repeat="EMAIL_ADDRESS in data.EMAIL_ADDRESS">
<span>{{EMAIL_ADDRESS}}</span><br />
</span
When Email Address is an array of 3, it displays as intended:
<span><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e232b7f0e3a2b3d3a602d2123">[email protected]</a></span><br />
<span><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee838bdcae9a8b9d9ac08d8183">[email protected]</a></span><br />
<span><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee838bddae9a8b9d9ac08d8183">[email protected]</a></span><br />
But when Email Address is just a string, it displays like this:
<span>m</span><br />
<span>e</span><br />
<span>@</span><br />
<span>t</span><br />
<span>e</span><br />
<span>s</span><br />
<span>t</span><br />
<span>.</span><br />
<span>c</span><br />
<span>o</span><br />
<span>m</span><br />
How can I avoid this scenario? It seems to be related to JavaScript behavior, and I'm unsure how to handle it within Angular.