mediaDataService.js
565 Bytes
angular.module('footyroom').service('mediaData', ['$window', function ($window) {
var callbacks = [];
var selected;
this.getMedia = function () {
return $window.DataStore.media;
};
this.onSelect = function (callback) {
callbacks.push(callback);
};
this.getSelected = function () {
return selected;
};
this.setSelected = function (selectedMedia, scroll) {
selected = selectedMedia;
callbacks.forEach((callback) => {
callback(selectedMedia, scroll);
});
};
}]);