-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Adding docs for non-working uppercase characters when using '=variable' ... #4719
Conversation
…e' in isolation of scope in directives
If you think this is an issue in angular please tell and I'll open the proper issue ;) |
I don't really understand where you're seeing this issue, can you demonstrate it? plunk I made real quick which uses a camelcased name and works fine I think I see what you're saying, you mean issuing the attribute as |
In your update, you didn't change the first two instances of the directive to classes. Fixing that makes it behave identical to the original plunk (http://plnkr.co/edit/D1x2L2?p=preview) Caitlin Potter On 2013-10-30, at 5:47 PM, Franco Arolfo notifications@github.com wrote:
|
You wrote: These won't work --- apparently only snake-cased forms for these attributes work. I'm not really sure if this is a "problem" or not, it seems like it's perfectly fine.
Right ! what do you mean with 'snake-cased forms for these attributes'? To me a common developer will use camel case in the attr's names and will have a friction point here. To me camelCase should be supported. |
BTW sorry for the update, my mistake. That was not my point so I deleted that message |
I'm not sure it's really a suggested thing to use camelCased attribute names for HTMLElements (or SVGElements or what have you), it is likely that the only reason you can use a directive's camelCased name is because So yeah, I dunno if this is something which really needs to be fixed. I think in general it's encouraged to use snake-cased attributes prefixed with |
I agreed in that snake-cased attributes are very common, data-something-non-stnadar is very common. And if angular will still be without it, at least to have it documented ;) |
HTML attributes are case-insensitive, so JavaScript is not keen on This is all outside of the scope of AngularJS. To fit with these issues and conventions AngularJS expects that all uses of directives in HTML do not use capital letters and that all uses of directives in JavaScript are "normalized" to camelCase. It is fair to make a note of this in the directives guide but I don't think the current wording is ideal. |
Fair to me, do you want to re write it or you have a docs team to throw the issue ? I don't know what is the 'protocol' to follow here hehe As note I liked all that that AngularJS is out of the scope of all that capital letter issues, and so expect the user in HTML not to use capital letters. Also I'd like to mention that I'd like AngularJS to work with '=aVariableInCamelCase' in a directive's scope, and this could be done by matching to the attr with that name, IT DOESN'T MATTER THE CAPITAL LETTERS; |
@farolfo - can you explain more what you mean by:
This paragraph doesn't make sense to me. Inside the JavaScript the capital letters are definitely important and you do indeed use camelCase when defining the scope. |
may be it's a bit incomplete haha
and in the directive code...
this doesn't work (is what this issue is about hehe). What we can do to fix this, cause capital letters are important in JS but NOT in HTML, is to match the attr name in the HTML with the attr name mentioned in value of the 'scope' JSON field, BUT IGNORING THE CAPITAL LETTERS. Does it make sense? My goal here is to have that scenario working cause it's a scenario that a regular developer might use. If you still don't see my point let me know and I'll try to explain it with code ;) |
farolfo@9dd68d7 |
The bottom line is that HTML is case insensitive and so you should not be using capital letters in your attributes. So your HTML must look like:
or similar. This is a well defined idiom in AngularJS. Perhaps you could identify further places in the documentation that could be improved to make this clearer. |
Ok I'll take a look, for now this is the only place I had troubles with this. |
awesome ! I'll do ;) Thanks ! |
...in isolation of scope in directives