As I prepare to transition into the view, I would like the controller to select a random audio file and play it. I'm feeling a bit lost on where to even begin with this task.
Controller:
var audioOne = new Audio("img/1.mp3");
var audioTwo = new Audio("img/2.mp3");
var audioThree = new Audio("img/3.mp3");
$scope.$on("$ionicView.beforeEnter", function () {
//I know I need to involve Math.Rand() somehow, but beyond that, I'm stuck.
}
Any assistance would be greatly appreciated. Just so you know, the goal is for the user to hear random words of encouragement when they reach that view. It's important that the audio is randomized to keep the user engaged and prevent them from getting bored of hearing the same audio repeatedly.