angular-table icon indicating copy to clipboard operation
angular-table copied to clipboard

scope events vs watched services for communication?

Open davidjnelson opened this issue 12 years ago • 1 comments

davidjnelson avatar Jun 24 '13 21:06 davidjnelson

via the angular google plus page, Dean Peterson asked:

"Reading through your code. I found the fireTrigger in your services interesting. Why didn't you use the $emit or $broadcast events?"

The reason I didn't use $emit or $broadcast is that I was using isolated scopes as a way to pass arguments. There is a way to pass string arguments without isolating the scope, but in terms of passing expressions, I don't know of a way. So I think this approach is still ideal. Open to discussion about this. From what I know, watched injected services are roughly as idiomatic as events, and should be equal in performance as long as they are extremely fine grained.

davidjnelson avatar Jun 25 '13 18:06 davidjnelson