Created
January 17, 2026 17:42
-
-
Save ppazos/a1d6dc0991009fd54115cc11336a8ca9 to your computer and use it in GitHub Desktop.
In Grails, the Goovy variables in GSP can be accessed by ${var} but that's also how JS string literals access variables, giving an error in GSP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Here Groovy prints the '$', leaving it for the JS to evaluate the variable correctly on the client side. | |
| let btnAuthorize = `<a href="merge/${'$'}{record.id}/authorize" class="btn btn-primary">Authorize</a>`; | |
| // This will fail if record is a JS object | |
| let btnAuthorize = `<a href="merge/${record.id}/authorize" class="btn btn-primary">Authorize</a>`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment