bookings
bookings copied to clipboard
error in go template variable inside javascript tag
Adding go template variable inside Javascript tag getting parsing error.
https://github.com/tsawler/bookings/blob/926f4423d0d6af714407dce3d8260f03f84f8b8c/templates/base.layout.tmpl#L156
I'm using go1.22.2 linux/amd64.
I have resolved the issue by modifying the javascript code.
<script>
function notify(msg, msgType) {
notie.alert({
type: msgType,
text: msg,
})
}
let error = "{{.Error}}"
if (error !== "") {
notify(error, "error");
}
let flash = "{{.Flash}}"
if (flash !== "") {
notify(flash, "success");
}
let warning = "{{.Warning}}"
if (warning !== "") {
notify(warning, "warning");
}
</script>