Wednesday, February 27, 2013

Initial reaction to element based directives and to root scoped examples

I don't like the idea of creating new 'E' element directives, simply because it makes it harder for a dev to later look at your code and know that your <custom-shit> tag is being manipulated from Angular. <div data-ng-custom-shit> seems a lot more self-explanatory.

Also, in a lot of examples, I'm seeing functions being defined in the root scope. This may be fine for a single page app, but if your code exists in a complex multi-page site, it would be cleaner to namespace functions like:

customNgNamespace = customNgNamespace || {};
customNgNamespace.customFunction = function(){/*...stuff...*/}

No comments:

Post a Comment