Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8858275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:47:29+00:00 2026-06-14T14:47:29+00:00

I am trying to build a small application using knockout, require, underscore. I have

  • 0

I am trying to build a small application using knockout, require, underscore.

I have my index page where i call in require and it points to a main.js were i keep my config

require.config({

paths: {
    jquery:     'vendor/jqm/jquery_1.7_min',
    knockout: 'vendor/knockout/knockout-2.2.0',
    underscore : 'vendor/underscore/underscore_amd',
    text:       'vendor/require/text',
    templates:  '../templates'
}

});

define(['app'], function(app) {

});

the rest of my index has no body. so when this is loaded it calls app.js

define(['jquery','knockout', 'appViewModel'],
 function($, ko, appViewModel) 
{
    ko.applyBindings(new appViewModel());
});

this should then call appViewModel which works ok. This is where i get a bit confused as i then want to load in a template from appViewModel

so I am trying to do something like this

define(['jquery','knockout', 'text!templates/homeViewTemplate.html', 'jqm'],
function($, ko, homeViewTemplate) {

      //call and load in template

});

this is where i get a bit stuck I know in backbone for example I could use

  template:_.template(homeViewTemplate)

but I am really not sure the best way of loading a template in here

I have looked at https://github.com/ifandelse/Knockout.js-External-Template-Engine but this doesnt work very well with require and if you use it without require and just put some text in a html file and call that in when I use jQuery mobile it doesnt add the classes etc.

I wondered if anyone could point me in the right direction.. I guess I am really trying to work out what code to put in here

    define(['jquery','knockout', 'text!templates/homeViewTemplate.html', 'jqm'],
function($, ko, homeViewTemplate) {

      //call and load in template

});

to call in the homeviewtemplate.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:47:30+00:00Added an answer on June 14, 2026 at 2:47 pm

    I use jQuery to insert the template HTML into the page and then apply my Knockout bindings.

    $('#selector').append(homeViewTemplate);
    ko.applyBindings(VIEWMODEL, $('#selector')[0]);
    

    You may also be interested in my WIP article about advanced knockout binding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this small application of mine I'm trying to deploy using visual
as titled, am trying to build a small application that will aggregate RSS from
I am trying to build a small web application. The application is to store
I'm trying to build a small testing app with erlang+mnesia. I have a user
I'm trying to build small web-system (url shortcutting) using nonsql Cassandra DB, the problem
I have a small site I built using the Play framework that I'm trying
I am trying to build a small application with a combobox and the issue
I'm trying to build a small Java app for connecting to an application called
im using spring+hibernate for a desktop application. I'm trying to build it with a
I am trying to build a small application in C# which should start/stop an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.