VividCortex / angular-recaptcha

AngularJS directive to add a reCaptcha widget to your form
http://vividcortex.github.io/angular-recaptcha/
MIT License
496 stars 257 forks source link

Unexpected token in key, error message being fuzzy #132

Closed AndersBillLinden closed 8 years ago

AndersBillLinden commented 8 years ago

When I use <div vc-recaptcha key="1234"></div> where 1234 actually is the code I got from https://www.google.com/recaptcha, (digits and letters without hyphens), I get the script error Syntax Error: Token '234' is an unexpected token at column 2 of the expression [1234] starting at [234] where 234 is the actual code, previously mentioned without the first character.

So it seems like my key was unparsable.

This issue could be a report of the kind unclear documentation or improvable error message. What is expected instead of the string I am using?

In your documentation the attribute key consists of both apostrophe and hyphen, but the documentation does not stress the presense of those characters. (I tried to include them without luck).

AndersBillLinden commented 8 years ago

Ok, a key needs to be surrounded with apostrophe and no hyphens, could the documentation be updated with clarification about that, please?

mtrias commented 8 years ago

I see in the documentation:

Here, the key attribute is passed to the directive's scope, so you can use either a property in your scope or just a hardcoded string

This is all pretty standard angular stuff. When you are passing a value to a directive binding, you write an angular expression in the attribute.

Is not that we require double quotes, we just require an angular expression.

AndersBillLinden commented 8 years ago

Ok, I think I was just inexperienced, thanks then :)

codedcontainer commented 8 years ago

Not sure why this issue is being closed. I have tried to add single quotes inside of double quotes and this still does not function correctly. I am not using a Angular expression but a attribute and string value. Still get a unexpected token at column 2 of express [key] starting at [key].