Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

How do I get data from JSON and pass it to an ionic 3 alert?

$
0
0

guys I’m trying to pass information from my JSON to this alert, I’m a little new with ionic, could someone help me?

TS:

  ionViewDidLoad() {
    this.qrCodeProvide.getBrowsers().then((data: any)=>{
      data.map((name) => {
        console.log(name)
      })
      console.log(data, 'ok');
      this.browsers = data;
    });
    console.log('ionViewDidLoad VetwebPage');
  }

  //botao para enviar para camera
  openQrcode(){
    this.navCtrl.push(QrcodePage, {animate: true} );
  }

  //alert para mostrar informações do navegador
  presentAlert() {

    let alert = this.alertCtrl.create({
      title: 'Information',
      subTitle: 'Browser: ',
      message: 'Last active session on: {b.name}',
      buttons: ['Disconnect', 'Exit'],
    });
    alert.present();
  }

JSON:

{
  "browsers": [ {
    "id": "1",
    "name": "Chrome",
    "date": "20 de Junho 2021 - 14:00"
  },
  {
    "id": "2",
    "name": "Firefox",
    "date": "15 de Janeiro 2021 - 21:00"
  },
  {
    "id": "3",
    "name": "Safari",
    "date": "05 de Dezembro 2020 - 15:32"
  },
  {
    "id": "4",
    "name": "Opera",
    "date": "07 de Março 2021 - 14:21"
  },
  {
    "id": "5",
    "name": "Edge",
    "date": "25 de Junho 2021"
  }]
}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>