How to use replace() for mutivalue ,I have no idea T____T thanks for your help
example
author Author
lang Language
date Date
loca Location
myjson
"FACETLIST":{
"FACET":[
{
"@NAME":"creator",
"@COUNT":"2"
},
{
"@NAME":"lang",
"@COUNT":"1"
},
{
"@NAME":"rtype",
"@COUNT":"1"
}
],
"FACET":[
{
"@NAME":"lang",
"@COUNT":"4"
},
{
"@NAME":"rtype",
"@COUNT":"2"
}
]
}
mycode
<ion-select [(ngModel)]="refine" (ionChange)="optionsFn(item, i);" >
<ion-option [value]="item" *ngFor="let item of totalfilter | mypipe;let i = index" >{{item["@NAME"]}}</ion-option>
</ion-select>
mypipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'mypipe', pure: false
})
export class MyPipe implements PipeTransform {
public posts;
public post;
transform(items: any[]): any[] {
if (items && items.length)
return items.filter(it => it["@NAME"] = it["@NAME"].replace( 'lang','Language' ) );
return items;
}
}
I try replace() have 1 value only! I want to add mutiply value in replace()