-1
I have an array of objects and I want to filter the properties and return only the properties with the lat and Lon greater than 0
How do I do it? How do I access lat and Lot?
I tried something like that but it doesn’t work:
var filtered = this.properties;
this.filtered.filter(p => {
return p.address.geoLocation.location.lat > 0;
});
json:
{
properties:[
{
"usableAreas": 70,
"listingType": "USED",
"createdAt": "2017-04-22T18:39:31.138Z",
"listingStatus": "ACTIVE",
"id": "7baf2775d4a2",
"parkingSpaces": 1,
"updatedAt": "2017-04-22T18:39:31.138Z",
"owner": false,
"images": [
"https://resizedimgs.com/crop/400x300/vr.images.sp/f908948bf1d9e53d36c4734d296feb99.jpg",
"https://resizedimgs.com/crop/400x300/vr.images.sp/bd37e4c09ddd370529489fbbc461dbec.jpg",
"https://resizedimgs.com/crop/400x300/vr.images.sp/7b86204f34b751c432c878d607c9d618.jpg",
"https://resizedimgs.com/crop/400x300/vr.images.sp/3b1142cffc13c49a1e7ea766c20a1d52.jpg",
"https://resizedimgs.com/crop/400x300/vr.images.sp/f519a27d56696febfb77f6398f4484d8.jpg"
],
"address": {
"city": "",
"neighborhood": "",
"geoLocation": {
"precision": "NO_GEOCODE",
"location": {
"lon": 0,
"lat": 0
}
}
},
"bathrooms": 1,
"bedrooms": 2,
"pricingInfos": {
"yearlyIptu": "60",
"price": "276000",
"businessType": "SALE",
"monthlyCondoFee": "0"
}
}]
this is the get method:
this.$http
.get(`properties?_page=${this.page}&_limit=${this.limit}`)
.then(res => {
this.properties = this.properties.concat(res.data);
this.page++;
if (res.data.length === 0) this.loadMore = false;
console.log(this.properties);
});