I have following receiver in my AngularJS Controller:
// Receive broadcast
$rootScope.$on('setPlayListEvent', function(event, playListData) {
if($scope.someSoundsArePlaying === true) {
$scope.stopAllSelectedSounds();
}
$scope.setPlaylistToView(playListData);
});
But it seems, that method called setPlaylistToView is always called and executed before the code:
if($scope.someSoundsArePlaying === true) {
$scope.stopAllSelectedSounds();
}
And so it can affect the result of the method.
I would like to ask, how can i set " execution order" of functions? Something like resolve..then..
Thanks for any advice.
stopAllSelectedSoundsdoes.$scope.someSoundsArePlayingis returning a promise or something else