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

  • Home
  • SEARCH
  • 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 7675523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:59:00+00:00 2026-05-31T16:59:00+00:00

I’m very new to backbone but I manage to get it working from tutorial.

  • 0

I’m very new to backbone but I manage to get it working from tutorial. But when I want to port those application to the backbone boilerplate I find myself stuck at the template. How do I access my model from my template? or even from the js file itself? I find myself stuck here for awhile now.

Backbone Boilerplate refers to https://github.com/tbranyen/backbone-boilerplate

  • 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-05-31T16:59:02+00:00Added an answer on May 31, 2026 at 4:59 pm

    For most javascript templating libraries, templating occurs in two phases.

    1. Pass a string (usually containing HTML) to the template engine’s “compilation” function. This returns you a “template function” you can execute. This only needs to happen once per template for the lifetime of your application.
    2. Render the template into output (usually HTML) by invoking the compiled template function and providing a “context” of data that will be available to the template. This can be done repeatedly with different context data to output different HTML.

    .

    //Compile your template string into a function
    //Happens 1 time only then you can cache the function
    var templateFunction = _.template("<p>Your <%- part %> is so <%- description %></p>");
    
    //Generate your output HTML with varying sets of data.
    var html1 = templateFunction({part: "nose", description: "big"});
    //html1 has "<p>Your nose is so big</p>";
    var html2 = templateFunction({part: "cat", description: "fat"});
    //html2 has "<p>Your cat is so fat</p>";
    

    This is the same basic idea for underscore templates, JST, jade, and most other templating engines. The “context data” is how your template gets access to your model. If you want, you can give it direct access to the underlying model by providing a context like: {model: myModel};. Then in your template you could do something like <%= model.get("displayName") %>.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.