javascript - Hiding HTML template from client side -


I want to keep my client-side code as clean and minimal as possible My project uses the knockout JS and this template engine: I have created the template in the lower section of my source code according to the team value given in the "Pre" section (I really do not want to appear). Is there a way to hide the template and when it loads the DOM?

To load your template from the server, give them your own small .html < / Code> files, and then on the client, you can use them to bring them into one variable:

  // Variables We are putting the template into var myTemplate; $ .ajax ({async: wrong, type: "gET", url: "/templates/myTemplate.html", success: function (data) {myTemplate = data;}});   

Then when you want to use the template, you can call templ () with the template:

  Var results = Tmpl (myTemplate, data);   

Note: I have forced jquery to synchronize to use async: false because you make sure You want to say that the template is present there.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -