Описание тега knockout-templating

Knockout templates are a simple and convenient way to build reusable view pieces, at the same time providing the option of repeating or nested blocks because they can recursively call themselves.

Knockout templates are a simple and convenient way to build reusable view pieces, at the same time providing the option of repeating or nested blocks because they can recursively call themselves.

A template in Knockout is defined using a <script> tag of type="text/html", e.g.:

<script type="text/html" id="person-template">
    <p>
        <span data-bind="text: surname"></span>
        (<span data-bind="text: firstname"></span>)
    </p>
</script>

Optionally, they can be recursive:

<script type="text/html" id="person-template">
    <p>
        <span data-bind="text: surname"></span>
        (<span data-bind="text: firstname"></span>)
    </p>
    <h4>Father:</h4>
    <div data-bind="template: { name: 'person-template', data: father }"></div>
</script>

References