I applied a single page application with AngularJS . A page consists of a content area in the middle and sections gathered around the center that show additional information and provide tools for managing the center.

Each section (called Side Info ) and the content area have a separate AngularJS controller assigned to them. I am currently communicating via $rootScope.$broadcast and $scope.$on() , for example.
app.controller('PropertiesController', function ($scope, $rootScope) { $scope.$on('somethingHappened', function(event, data){ // react }); });
Then I call to communicate with other controllers:
$rootScope.$broadcast('somethingHappened', data);
I have a lot of communication between controllers. Especially if something happens in the content area, it is necessary to accept several elements of additional information. Another way is also frequent: the user submits the form (located in the additional information), and the content area and other elements of the additional information must accept.
My question is: Is there a better way to deal with SPA through complex communication with the controller?
The code works fine, but it is already a bit confusing (for example, it is difficult to find which events are processed there, etc.). Since the application is likely to grow in the coming weeks, I would like to make these changes (if there are any better solutions) as soon as possible.
javascript angularjs
West
source share