I would like to know how to find certain td text and replace all of the texts with a new text in angular.
json
myData = [
{
"type": "toyota",
"year": "2013",
"comment": "new"
},
{
"type": "audi",
"year": "2013",
"comment": "new"
},
{
"type": "honda",
"year": "2019",
"comment": "new"
},
{
"type": "ford",
"year": "2019",
"comment": "new"
}
]
component.html
<div>
<table >
<tr *ngFor="list of myData$">
<td>{{list.type}}</td>
<td>{{list.year}}</td>
<td>{{list.comment}}</td> //want to show "old" or " " instead of "new" for all cars with year "2013"
</tr>
<table>
</div>
Can contains() function works for such in .ts file?
Try like this:
Working Demo