arnaud.breton arnaud.breton - 1 year ago 134
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
Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download