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
Its a typo its :
$rootScope.$broadcast(name, args)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With