spring boot - Javascript not loading on internal thymeleaf link -


when open new form, js works, upon edit fails load internal js. please work under assumption of data , routing hooked appropriately.

i've got link open form existing object:

<a th:if="${foo.typename} == a" href="edit"        th:href="@{/afoo/{id}(id=${foo.id})}">view</a> 

controller methods:

new object:

@requestmapping(value="/afoo", method=requestmethod.get)     public string newafooform(model model) {         fooviewmodel fooviewmodel = new fooviewmodel(type.a);         model.addattribute("fooviewmodel", fooviewmodel);         return "fooform";     } 

load existing object:

@requestmapping(value="/afoo/{id}", method=requestmethod.get)     public string editafooform(@pathvariable("id") long id, model model) {         fooviewmodel fooviewmodel = assignfooviewmodel(id);         model.addattribute("fooviewmodel", fooviewmodel);         return "fooform";     } 

the form html/th code shouldn't matter, describe js references:

layout.html container both forms. has js imports:

<script th:src="@{js/jquery-1.11.3.min.js}"></script> <script th:src="@{js/bootstrap.min.js}"></script> <script th:src="@{js/parsley.min.js}"></script> 

and template js on contained pages:

<div layout:fragment="script"></div> 

fooform.html has additional js imports, ton of js code, starts:

<div layout:fragment="script">     <script th:src="@{js/typeahead.bundle.min.js}"></script>     <script th:src="@{js/handlebars.js}"></script>     <script>     ....     </script> </div> 

my first thought i'm somehow writing link wrong loses context of referenced js. thoughts? thanks.

the js imports should have format:

<script href="/js/handlebars.js" th:src="@{/js/handlebars.js}"></script> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -