I am facing a challenge in updating views on multiple components simultaneously. To address this issue, I have implemented the use of broadcast functionality. However, when I execute my code without including $apply(), the views fail to update properly. On the other hand, if I utilize $apply() on multiple views, an error message stating '[$rootScope:inprog] $apply already in progress' is displayed.
Updated Code
service.prototype.setNewTopic = function (topic) {
var self = this;
var promise = $http(
{
method: 'POST',
url: self.baseUrl + 'Admin/setNewTopic',
contentType: 'application/json',
data: {
topicName: topic
}
});
return promise;
}