Hi i m trying to get the data from a loop i wrote to go through a object and get some data from there.
my object looks like this
{
id:12,
cities:[london, lisbon, berlin],
images[{id:1, image_urls:abc,},{id:2, image_url:bcd}, {id:3, image_url: cde}],
status: "published"
}
the function i wrote is to get the image_url data from this object:
imagesUrlFunction() {
console.log("array Length");
console.log(this.images.length);
let keys = this.images.length;
for (let n = 0; n < keys; n++) {
this.imagesUrls = this.images[n].image_url;
console.log("imageUrlMedia Var");
console.log(this.imagesUrls);
// console.log(this.images[n]);
}
}
When i console log this.imagesUrls i can get my data, that is my url, and because is in loop i can get all the urls, or at least console log all urls.
My problem is i want to put that that into an object so i can use it with an *ngFor directive, but i cant. I tried to create an empty object and assign imagesUrls to it, but with no sucess.
Can anyone help?
Thanks for your patient, i am just a newbie in javascript and educating my self on it.
image_urls
and the others have a propertyimage_url
. I assume thes
at the end of the first one is just a typo, but you may want to fix that ;) – Archer Jul 9 at 11:12