Get started with knockout-pre-rendered CDN

Apache licensed

Pre-rendered Knockout.js component: generates upfront HTML for performance.

Tags:
  • knockout
  • foreach
  • pre-rendered
  • initialize
  • javascript

Stable version

Copied!

How to start using knockout-pre-rendered CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with knockout-pre-rendered CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/knockout.min.js"></script>
  <script src="https://cdn.cdnhub.io/knockout-pre-rendered/0.11.0/knockout-pre-rendered.min.js"></script>
  <style>
    #myContainer { width: 300px; }
  </style>
</head>
<body>
  <div id="myContainer"></div>
  <script type="text/html" id="myTemplate">
    <div>
      <h1 data-bind="text: title"></h1>
      <p data-bind="text: message"></p>
    </div>
  </script>
  <script>
    const ViewModel = function() {
      this.title = "Welcome to Knockout Pre-rendered!";
      this.message = "This is a pre-rendered example.";
    };

    ko.applyBindings(new ViewModel(), document.getElementById("myContainer"), "#myTemplate");
  </script>
</body>
</html>
Copied!
Copied!

All versions