I am trying to display an image from a json on an ionic card. I get the JSON response in the console log but can't get the image to show up. so I end up having a blank card. I am obviously messing something up in the html. Any help would be great thank you! below is a screenshot of the empty card.
Home.Html
<ion-card>
<ion-card-content>
<ion-item *ngFor="let attribute of attributes">
<img data-src='{{attribute.pic_url}}' />
<ion-card-title>
{{attributes.description}}
</ion-card-title>
</ion-item>
</ion-card-content>
</ion-card>
home.ts
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
private storymap : FormGroup;
private title: string;
private author: string;
private link: string;
private inputName='';
private result: any;
private data: Observable<any>;
private appid = this.inputName.substring(this.inputName.indexOf("appid=")+6,this.inputName.length);
private subtitle: string;
private attributes: string[];
private geometry: any[] = [];
private photo: string[];
constructor(public navCtrl: NavController, public http:HttpClient, private formBuilder: FormBuilder) {
this.storymap = this.formBuilder.group({
storymapurl: [''],
title: ['', Validators.required],
author: [''],
description: [''],
});
}
logForm(){
if ( this.inputName.length > 3 ) {
this.appid = this.inputName.substring(this.inputName.indexOf("appid=")+6,this.inputName.length);
console.log(this.appid);
fetch(`https://www.arcgis.com/sharing/rest/content/items/${this.appid}/data?f=json`)
.then(response => response.json())
.then(metadata => {
this.title = metadata["values"]["title"]
//console.log(this.title)
this.subtitle = metadata["values"]["subtitle"]
this.author = metadata["values"]["author"]
//console.log(this.subtitle)
return fetch(`https://www.arcgis.com/sharing/rest/content/items/${metadata["values"]["webmap"]}/data?f=json`)
})
.then(response => response.json())
.then(data => {
let data_res = Array.of(data);
this.attributes = Object.keys(data_res["operationalLayers"]["0"]["featureCollection"]["layers"]["0"]["featureSet"]["features"]["0"]["attributes"]);
console.log(this.attributes.pic_url);
this.geometry = Object.keys(data["operationalLayers"]["0"]["featureCollection"]["layers"]["0"]["featureSet"]["features"]["0"]["geometry"])
//this.photo = Object.keys(data["operationalLayers"]["0"]["featureCollection"]["layers"]["0"]["featureSet"]["features"]["0"]["attributes"]["pic_url"])
//console.log(this.photo)
console.log(data)
return this.attributes
});
}
console.log(this.storymap.value)
} }


console.log(this.attributes)? if you post the array here will be better not the screen shot.