Skip to content
to-repeat.pipe.ts 435 B
Newer Older
wangqinghua's avatar
wangqinghua committed
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'toRepeat'
})
export class ToRepeatPipe implements PipeTransform {

  transform(value: any): any {
    let str = [];
    let arr = [];
    arr = value.map(e=>{
      return e.mediaTypeName;
    });
    for(let i = 0;i < arr.length ;i++){
      if(!str.includes(arr[i])){
        str.push(arr[i]);
      }
    }
    const res = str.join(" ");
    return res;
  }

}