Reputation: 7283
I am adding items dynamically to an array of items and would like to let a directive know that there are new items. So inside the controller function addItem() I am trying to do the following:
setTimeout(function(){
$rootScope.broadcast("itemAdded");
// I also tried: $scope.broadcast("itemAdded"); which isn't working
});
Problem: I'm getting the error:
$rootScope.broadcast is not a function
Upvotes: 6
Views: 6502