Delete the return statement in the service:
angular
.module('commons')
.service('MediaService', function () {
this.selectedMedia = {}
this.isPlaying = false
//DELETE the return statement
̶r̶e̶t̶u̶r̶n̶
//OR
return this;
})
By using a return statement without a value, the constructor function returns a value of undefined. Without a return statement, the constructor will automatically returnreturns the this object created by the new operator.
The string needs quotes:
div.content
video(
controls
ng-if="MediaService.selectedMedia.type != ̶a̶u̶d̶i̶o̶ ͟'͟a͟u͟d͟i͟o͟'͟ "
)
source(
ng-src="{{MediaService.selectedMedia.url}}"
type="video/mp4"
)
audio(
ng-if="MediaService.selectedMedia.type == ̶a̶u̶d̶i̶o̶ ͟'͟a͟u͟d͟i͟o͟'͟ "
)
source(
ng-src="{{MediaService.selectedMedia.url}}"
type="audio/mp3"
)
Without quotes the media type is being compared to $scope.audio which is undefined.