close
 
filterTest (input_p: any) {

// get array property
this.tmep_lcc = this.data.map(x => x.LCC );
console.log('get array property');
console.log(this.tmep_lcc);

// distinct array property
this.tmep_lcc = Array.from(new Set (this.data.map(x => x.LCC )));
console.log('distinct array property');
console.log( this.tmep_lcc);

// with sort
this.tmep_lcc = Array.from(new Set (this.data.map(x => x.LCC ))).sort();
console.log('sort');
console.log(this.tmep_lcc);

// filter array by input value
this.temp_data = this.data.filter(x => x.LCC.startsWith(input_p)); // 不用加data : x.data.toLowerCase()
}
 
arrow
arrow
    全站熱搜
    創作者介紹

    Chill_Radio 發表在 痞客邦 留言(0) 人氣()