Hi All, Angular newbie here.
I'm attempting to organize my code into re-useable pieces. In this particular case, I have a taskMonitorController, an html template view, and directives in the template that update the view depending upon the progress of a long running task within the controller via callbacks from $http service. I have a variety of tasks which are long running, so why would I want to make a bunch of individual controllers when really all that changes is the title of the task to display to the user, and the query to submit to the server? Therefore, my goal is to use ngRoute's $routeProvider to load the same template and controller for a variety of different matching paths. However, when the controller loads, I want $scope to have 2 properties injected based on which route was specified. A title and a url. Perhaps manipulating scope from routeProvider is not the best idea, or is it? What would be the best way to do this? P.S. On another note, I have considered a pub/sub setup in where I create a primary controller that contains the initial data respective to it and load that with the routeProvider, whose template has the taskMonitorController referenced in it, but then when the primary controller is loaded on route change, there is a delay before the template's taskController is ready it seems? Because the broadcast to the child controller is not received, unless I add an $interval service to the primary controller to wait a second for the inner taskMonitorController to be ready I guess? Also, if it changes anything, taskMonitorController lives in a utilModule, which I declared as a dependency in the declaration of the parent module. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
