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);
}
});