I am getting a value using ngModel
from my back-end in a text box. This is linked to a searchable drop-down (which I populate using <p>
tags and where I am using innerHtml
).
If I should display registered trademark symbols in the text box, how do I do it? Any ideas? Or angular directives?
The values are getting saved in DB as HTML Byte characters from another service that I sync with (For eg., registered trademark as ®
)
<div class="Top-selection">
<input type="text" class="" placeholder="Type here to select a brand" (blur)="checkProperData()"
id="brand-id" #BRAND_ID="ngModel" [(ngModel)]="cmpgnCtgry['BRAND_ID']"
name="BRAND_ID" (click)="showBrands(row_no)" (keyup)=filter(row_no)/>
<div class="filterbox width300px" *ngIf="disableShow[row_no]">
<div *ngFor="let brand of brandList">
<p [innerHTML]="brand.brandName" (click)="selectCatalogId(brand.brandName, brand.brandUniqueId, brand.brandId, row_no)">
{{brand.brandName}}</p>
</div>
</div>
</div>
I am talking about the box that reads BRAND_ID here
I also tried doing the following,
var p = document.createElement('div');
p.textContent = this.campaign['CMPGN_DTL_TX'].CMPGN_CTGRY[i].BRAND_ID;
this.campaign['CMPGN_DTL_TX'].CMPGN_CTGRY[i].BRAND_ID = p.innerHTML;
console.log(p.innerHTML);
I really didn't understand why this wasn't working. I have implemented this in my .ts
component file. Is it that logging this won't help? (It is not getting updated in the HTML either).
Also, I'm really surprised that there is no standard way of converting it to registered trademark - that we have to use regular expressions and replace < or & symbols.