I am trying to bind data inside a div using [innerHtml]. How to notify angular to use the variables instead of the raw text. Here is my setup :
<div *ngFor="let data of someData">
<div *ngFor="let odata of someOtherData;trackBy:id">
<div [innerHTML]="odata.template | pipeToSanitize"></div>
</div>
</div>
The data looks like this :
someOtherData = [{
'id': 1,
'template': '<div class="{{data.class}}"><md-icon>{{data.icon}}</md-icon></div>'
},
{
'id': 2,
'template': '<div>{{data.timestampStr}}</div>'
},
{
'id': 3,
'template': '<div>{{data.message}}</div>'
}]
someData = [{
'message': 'Message 1',
'timestampStr': '2016/12/13 09:25:00',
'class': 'events-warn-color',
'icon': 'warning'
},
{
'message': 'Message 2',
'timestampStr': '2016/12/13 10:36:00',
'class': 'events-warn-color',
'icon': 'warning'
}];
Now I am getting {{data.icon}},etc. as it is. How can replace this with the contents from 'someOtherData' object. Thanks in advance