Search code examples
angularjsvalidationw3cbraces

Double curly braces in angularjs avoid w3c validation


I have an html page that uses the following line of code:

... <a href="nolf://{{server.ip}}:{{server.hostport}}/"> ...

When I try to validate the page, I got the following error:

"Bad value nolf://{{server.ip}}:{{server.hostport}}/ for attribute href on element a: Illegal character in scheme data: not a URL code point."

It seems that the validator does not like seeing the curly braces in a URL link. If I remove them, all goes well. They are "unsafe" so they need to be encoded but if I encode them, the AngularJS instructions do not work anymore.

Is there a workaround, a way, to validate this? (original page where this code is can be found here: http://oneoakway.com/nolf/servers/ - there is a validation link in the footer)


Solution

  • Use ng-href instead. This will properly apply the expression to a href attribute.