How can I trigger a broadcast from one service to another?
.factory('BetSlipFactory', function()
removeSlip: function(slip) {
$rootScope.$broadcast('removeSlip:betSlipFactory');
return betSlipSelectionRequest('/betSlip/removeSelection', {
game: slip.game,
pair: slip.pair,
line: slip.line
});
}
})
I am looking to include a call to the getLines
function whenever removeSlip
is invoked.
.factory('LinesFactory', function($q, $http, $rootScope, CONSTANT_VARS) {
//THIS IS WHERE I NEED TO TRIGGER GETLINES
//FROM THE BROADCAST
return {
getLines: function(params, selections) {
$http.post(CONSTANT_VARS.BACKEND_URL + '/lines/lines', params)
.success(function(lines) {
console.log(lines)
});
}...
});