I am trying to plug in some html content in an Angular component The components fetches the HTML using a service call and sets the property which is bound to innerHtml of the div.
There is a bunch of styles that needs to be set for this html plug, as given below in the scss content.
But I am not sure how to do this .... tried ngStyle and ngClass to return the style and use in the div but that did not work. Can anyone please tell me how to apply style for innerHtml? - Thanks
<div class [innerHTML]="html"></div>
private fetchEmail() {
const d = this._intl.formatDate(this.today, 'yyyy-MM-dd');
this._vmService.getVariatioMarginEmail(d).subscribe(e => {
if (!isUndefined(e) || e.length > 0) {
this.html = e.html;
}
});
}
.table {
border-collapse: collapse;
border: 1px solid #999;
font: normal 11px verdana, arial, helvetica, sans-serif;
color: #F6ECF0;
background: transparent;
}
th {
border: 1px solid #999;
text-align: left;
vertical-align: middle;
font-weight: 700;
background: #333a56;
color: #fff;
padding: 5px 10px;
}
td {
border-collapse: collapse;
border: 1px solid #999;
padding: 5px 10px;
color: #555;
}
tbody td a {
background: transparent;
text-decoration: none;
color: #F6ECF0;
}
a {
font: normal 11px verdana, arial, helvetica, sans-serif;
}