duannuo4620 2017-04-20 10:24
浏览 32

Ionic 2 - 数据库内容不可点击

I am adding data from database to my ionic2 application here is a piece of code of the php file:

if(!empty($oefening1) && !empty($rep1) && !empty($set1)){
    echo "<ion-card class='card card-md nextPage1'><img src='assets/img/" . $oefening1 . ".jpg'/>
             echo "<ion-card-content class='card-content card-content-md'
                            <ion-card-title class='card-title card-title-md'>" . $oefening1 ."</ion-card-title>".
                            "<p> Herhalingen:" . $rep1 . "<br> Sets:". $set1 . "</p>".
                    "</ion-card-content></ion-card>"; 
            }

and what I tried was this:

<ion-card (click)="test()"></ion-card>

But this is not working.

this is my ajax call where i store the data locally with localForage:

 $.ajax({
    type: "POST",
    url:  "http://sylvanreinieren.com/fysioWebapp/php/get_schema.php",
    data: { dataString: tokenValue },
    cache: false,
    success: function(data){
        $('#myDiv').html(data);

        localForage.setItem('getSchema', data).then(function (data) {
            // Do other things once the value has been saved.
            console.log(data);
        }).catch(function(err) {
            // This code runs if there were any errors
            console.log(err);
        });
    }
  });

That works fine as you see I give an nextPage1 class with it. But when I try to use this in my application it is not working the function look like this:

 ionViewDidLoad(){
    $('.nextPage1').click(function () {
       console.log('worked');
       this.navCtrl.push(ExercisePage);
    });
}

So the data is loaded and is there with the class but it seems it couldn't pick it up to handle an click event. Why is that? It seems like it can't detect the elements but I think thats weird because I load them like this:

ionViewWillEnter(){
 localForage.getItem('getSchema', (err, data) => {
  if(data){
    $('#myDiv').html(data);
  }
});
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用C语言输入方程怎么
    • ¥15 网站显示不安全连接问题
    • ¥15 github训练的模型参数无法下载
    • ¥15 51单片机显示器问题
    • ¥20 关于#qt#的问题:Qt代码的移植问题
    • ¥50 求图像处理的matlab方案
    • ¥50 winform中使用edge的Kiosk模式
    • ¥15 关于#python#的问题:功能监听网页
    • ¥15 怎么让wx群机器人发送音乐
    • ¥15 fesafe材料库问题