Hari Subramaniam
Hari Subramaniam

Reputation: 1876

Externalizing knockout templates

i am using knockout.js and asp.netmvc. While i am familiar with knockout.js i am not sure how to externalize the templates. So,

1.)How to externalize knockout templates 2.)Is there a way to bundle the templates just like we bundle css and JS in MVC4

Upvotes: 2

Views: 1302

Answers (2)

PatrickSteele
PatrickSteele

Reputation: 14677

With Razor as your view engine, you could create partial views for your templates and then include them with Html.Partial():

<script type="text/html" id="person-template">
    @Html.Partial("person")
</script>

Upvotes: 3

Kyeotic
Kyeotic

Reputation: 19847

Have you seen Knockout External Templates?

Upvotes: 3

Related Questions