module Sfx { export class ControllerManagerService { public firstPageLoad : boolean = true ; private currentControllers : IControllerBase [ ] = [ ] ; constructor ( private $q ) { } registerMainController ( controller ) { this . currentControllers = [ ] ; this . registerController ( controller ) ; } registerController ( controller ) { this . currentControllers . push ( controller ) ; } refreshCurrentControllers ( messageHandler ? ) { let promises = [ ] ; $ . each ( this . currentControllers , ( _ , ctrl ) => { promises . push ( ctrl . refresh ( messageHandler ) ) ; } ) ; return this . $q . all ( promises ) ; } } ( function ( ) { let module = angular . module ( "controllerManagerService" , [ ] ) ; module . factory ( "controllerManager" , [ "$q" , ( $q ) => new ControllerManagerService ( $q ) ] ) ; } ) ( ) ; }