angularjs - Angular using callbacks vs using broadcast/emit/on paradigm -


my question regarding best practices between using more direct callback structure vs. event broadcasting , listening. had not been using broadcast/emit/on event propagation framework. rather had been creating callback register , firing registered callbacks when known event occurs (at source of event). done via services.

how efficient broadcast/emit/on paradigm? should using instead? efficient callback type of structure?

thanks.

it's less question of efficiency rather maintainability. when use emit , broadcast coupling mechanisms communication view because $scope fundamentally fabric data-binding. services approach far more maintainable because can test communication without spinning scope , can communicate between services in addition controllers. $scope $broadcast , $emit ever able communicate there $scope can inject.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -