HI,
i do not know if I am in the right place but here is my problem I can not get the value of src
under ionic 3 thank’s for all
here is my code .ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { ActionSheetController } from 'ionic-angular';
import { Http, Headers} from '@angular/http';
import 'rxjs/add/operator/map';
/**
* Generated class for the ActualitésPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-actualités',
templateUrl: 'actualités.html',
})
export class ActualitésPage {
constructor(public navCtrl: NavController, public navParams: NavParams, public http: Http) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad ActualitésPage');
}
users:any;
loadJson(){
this.http.get('link')
.map(res => res.json())
.subscribe(res =>{
this.users = res.nodes;
},(err)=>{
alert("erreur chargement Json");
});
}
}
my html code
<!--
Generated template for the ActualitésPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Actualités</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<button ion-button (click)="loadJson()">
Chargement
</button>
<ion-list>
<ion-item *ngFor="let user of users">
<ion-avatar item-start>
<img src="">
</ion-avatar>
<h2>{{user.node.Image_descriptives[user.node.Image_descriptives.src]}}</h2>
<h2>{{user.node.title}}</h2>
</ion-item>
</ion-list>
</ion-content>
and the json
{
"node": {
"title": "Cameroun – Affaire MIDA : neuf suspects interpellés et livrés à la justice, sept autres recherchés",
"Image descriptives": {
"src": "https://www.link.com/sites/default/files/field/image/affaire-mida-communication-gouvernement.jpg",
"alt": ""
}
}
},
I have already tried this without success
{{user.node.Image_descriptives.src}}
{{user.node.Image_descriptives[0].src}}
{{user.node.Image_descriptives[src]}}