Well, I am trying to use ng-click now and I am getting everything just
right. Except the sound. The music wouldn't play. Here's the progress.
HTML
<audio id="player{{$index}}" src="{{'media/question_' + ($index+1) +
'.mp3'}}" type="audio/mpeg"></audio>
<div class="btn" ng-click="playAudio()" >Play</div>
Angular function in the controller
$scope.playAudio = function () {
whichPlayer = '#player';
whichPlayer = whichPlayer + $scope.activeQuestion;
console.log(whichPlayer);
$scope.player = document.querySelector(whichPlayer) ;
console.log($scope.player) ;
player.play();
}
console is exactly right
#player0quiz.js (line 54)
<audio id="player0" src="media/question_1.mp3" type="audio/mpeg">
quiz.js (line 57)
--
You received this message because you are subscribed to the Google Groups
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.