Ok, I figured it out. Here is a reference if anyone is hitting the same problem:
classes/output.mobile.php
return [
'templates' => [
[
'id' => 'main',
'html' => $OUTPUT->render_from_template('PATHTOMUSTACHEFILE', $data),
],
],
'javascript' => file_get_contents($CFG->dirroot . 'PATHTOJSFILE'), //IMPORTANT LINE TO CALL JS FILE
'otherdata' => '',
'files' => '',
];
In JS File (which needs to be referenced in classes/output/mobile.php)
(function(t) {
//AlertController is the missing piece here, in Ionic documentation it is referenced differently since their construct names it a different name
//However digging through Moodle Mobile code you can find it exported/named as AlertController... I am assuming ModalController will be similar
t.presentAlert = function() {
let alert = this.AlertController.create({
title: 'Low battery',
subTitle: '10% of battery remaining',
buttons: ['Dismiss']
});
alert.present();
}
})(this);
In Mustache File
classes/output.mobile.php
return [
'templates' => [
[
'id' => 'main',
'html' => $OUTPUT->render_from_template('PATHTOMUSTACHEFILE', $data),
],
],
'javascript' => file_get_contents($CFG->dirroot . 'PATHTOJSFILE'), //IMPORTANT LINE TO CALL JS FILE
'otherdata' => '',
'files' => '',
];
In JS File (which needs to be referenced in classes/output/mobile.php)
(function(t) {
//AlertController is the missing piece here, in Ionic documentation it is referenced differently since their construct names it a different name
//However digging through Moodle Mobile code you can find it exported/named as AlertController... I am assuming ModalController will be similar
t.presentAlert = function() {
let alert = this.AlertController.create({
title: 'Low battery',
subTitle: '10% of battery remaining',
buttons: ['Dismiss']
});
alert.present();
}
})(this);
In Mustache File
add (click)="presentAlert()" to any button of your choosing