Every time array are repeatedly print when page is incremented again push new value with old value
how to remove duplicate value and push unique value
loadMorePost(){
this.http.get("https://mydomainname.com/wp-json/wp/v2/review/?per_page="+this.page)
.map(res => res.json())
.subscribe(data => {
let dataa =data;
console.log(dataa)
this.infinite.complete();
if (this.page == 10) {
this.morePostss = new Array;
this.infinite.enable(true);
}
if (dataa.length != 0) {
console.log(dataa.length)
this.page++;
///this.morePosts = this.morePosts.concat(this.items)
for (let value of dataa) {
console.log("Data are same")
this.morePostss.push(value);
console.log(this.morePosts)
}
}
if (dataa.length == 0 || dataa.length < 10) {
this.infinite.enable(false);
this.toastCtrl.create({
message:"No post found!",
duration: 3000,
}).present()
}
},(error)=>{
console.log(error)
})
}
Please help me out