davidjnelson / angular-table

An angular directive for a table with fixed, sortable headers, row selection, row even/odd coloring, which automatically stays the correct height relative to its container when the browser is resized. No javascript code required; the api is a 100% declarative dsl.
http://angulartable.com
174 stars 30 forks source link

scope events vs watched services for communication? #13

Open davidjnelson opened 11 years ago

davidjnelson commented 11 years ago

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.