My md-collection is set up to display a list of emails like this:
<md-collection-item repeat.for="u of user" class="accent-text">
<div class="row">
<div class="col">
<p>${findEmailAddress(u.email)}</p>
</div>
</div>
</md-collection-item>
In TypeScript, the findEmailAddress function looks like this:
findEmailAddress(userId: string) {
return ((this.Persons|| []).find(x => x.userId == userId) || {}).email;
}
The emails are displayed in the format:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5e2e3b3f3d363b2d1e2a3b2d2a703d3133">[email protected]</a>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="076677776b6247736274732964686a">[email protected]</a>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="27574e49424657574b4267534254530944484a">[email protected]</a>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4a282b242b242b0a3e2f393e64292527">[email protected]</a>
I want to sort the emails alphabetically like this:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="15746565797055617066613b767a78">[email protected]</a>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bedcdfd0dfd0dffecadbcdca90ddd1d3">[email protected]</a>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e6968387858e8395a692839592c885898b">[email protected]</a>
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c7c6562696d7c7c60694c78697f78226f6361">[email protected]</a>
I attempted using the sort method like this:
let test =((this.Persons|| []).find(x => x.userId == userId) || {}).email;
return test.sort() ---> but it fails on sort and says "sort does not exists on type string"