ParseError.tagTemplateNotFound ("short \"). Val ")

I am working on a very simple Vapor application. I am currently working on one of the following:

#extend("base")

#export("body") {
    <form>
        <div class="row">
                <div class="six columns">
                    <label for="exampleEmailInput">Acronym</label>
                    <input class="u-full-width" type="email" id="short">
                    </div>
                <div class="six columns">
                    <label for="exampleRecipientInput">Long form</label>
                    <input class="u-full-width" type="email" id="long">
                </div>
        </div>
    </form>
    <div class="row">
        <div class="five columns"></div>
            <div class="two columns">
                <a class="button button-primary" id="submit" href="/acronym/all">Save Acronym</a>
            </div>
        <div class="five columns"></div>
    </div>
    <script>
        function setHref() {
            var short = $("#short").val();
        }
    </script>
}

This code works until I add a variable shortto the function setHref. Then I get a parsing error:

Uncaught Error: ParseError.tagTemplateNotFound("short\").val"). Use middleware to catch this error and provide a better response. Otherwise, a 500 error page will be returned in the production environment.

Why is this happening?

+2
source share
1 answer

The sheet finds #shortand analyzes it as a tag. I assume that you are looking for some kind of escaping mechanism. Here are a few options:

#()short => #short
#raw() { #short } => #short
+3
source

Source: https://habr.com/ru/post/1682651/


All Articles