arnaud.breton arnaud.breton - 3 months ago 70
AngularJS Question

Namespacing events in Javascript/AngularJS?

I'm wondering if is there a naming convention to namespacing events with AngularJS?

jQuery defines its convention as

(with namespace at the end, and dot separator)

I've seen some articles (example) where events are named like this:
(with namespace at the start; and double-colon separator)

Is there a common practice on this subject?

Thanks for your thoughts about it.

m59 m59

I haven't heard of anything specific regarding angular, but you should consider that namespacing is a generally good practice for many situations. If you're writing a simple app that won't incorporate other scripts, there isn't much need to namespace. Just consider what could happen in the future of your script's environment (whether event's names could end up clashing) and base your decision on that.