Is there a better way to reuse templates than renderTemplate?

89 views
Skip to first unread message

ma...@tplus1.com

unread,
Jul 1, 2014, 9:53:36 AM7/1/14
to knock...@googlegroups.com
Hi --

I have a bunch of code that looks vaguely like this:

    self.open_edit_modal = function () {
    
        ko.renderTemplate(
            "edit-bundle-modal",
            self,
            {},
            $("#my-modal")[0]);
            
        $("#my-modal").modal("show");                     
    };  

In other words, I have a bunch of places in my webapp that load a named template defined in a script tag and then render it.

There's hardly any documentation at all on renderTemplate.  Is that because we're not really supposed to use it?  Is there a more conventional way of loading a named template and then rendering it?

Why isn't renderTemplate better documented?

Matt

PS: I <3 knockout

marto...@gmail.com

unread,
Jul 1, 2014, 12:27:58 PM7/1/14
to knock...@googlegroups.com, ma...@tplus1.com
Hi,

I'm using it from Html data-bind.

Rachel Silver

unread,
Jul 2, 2014, 9:39:11 AM7/2/14
to knock...@googlegroups.com, ma...@tplus1.com, marto...@gmail.com

Bart Breen

unread,
Jul 3, 2014, 8:05:55 AM7/3/14
to knock...@googlegroups.com
+1 for Knockout components as they are pretty unobtrusive and will allow you to integrate them with your existing code
Reply all
Reply to author
Forward
0 new messages