Well I suppose you can't *not* create directives dynamically, but what I 
mean is, I'm creating several of them in a loop, the same way it is done in 
several places the angular source code.  Then I'm creating another 
directive that contains a switch statement between the dynamically created 
ones.  To embed the directives into the switch statement, I had to copy the 
camelCase/snake_case functions from the angular source code, since they 
aren't accessible.  I realize I could have just made this be one directive 
with a single massive template.  Anyway, that is all irrelevant to my point.

I'm just trying to say it's silly to have to name directives in camelCase 
when you have to use them in snake-case.  Why don't we just use snake-case 
all along?  This could be supported without dropping backward 
compatibility.  If the name is already in snake case, don't change it. 
 Convert it to camelCase internally if you need to.

On Wednesday, April 9, 2014 2:17:13 PM UTC-7, Nick Retallack wrote:
>
> Today I tried to dynamically create and use some directives at runtime. 
>  Then I realized I have to spell them differently when I create them from 
> when I use them.  This is silly.  Now I have to procedurally translate them 
> between camelCase and snake-case myself.
>
> One of my previous co-workers also thought this was stupid.  He was 
> looking at my angular templates and then trying to grep the source code for 
> where those attributes are used.  If I were using jQuery, those attributes 
> would have shown up in the source code in selectors.  But since it's 
> angular, they were camelCased, and thus un-greppable.
>
> Being able to grep your source code for identifiers is one of those 
> unspoken rules of software development, isn't it?
>
> Since a directive's name is just a string, why can't we just write it the 
> way it is going to appear, in snake-case?  I've heard the argument that it 
> needs to be a valid JavaScript identifier, but when is it ever interpreted 
> in JavaScript?  Angular is moving toward Polymer anyway, and in Polymer you 
> have to name tags with dashes in them in the first place.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to