-1

I have a collection which contains an Array of tab Models

like

[
  new TabModel({ title: 'Step 1', template: 'step1.html' }),
  new TabModel({ title: 'Step 2', template: 'step2.html' }),
  new TabModel({ title: 'Step 3', template: 'step3.html' }),
  new TabModel({ title: 'Step 4', template: 'step4.html' })
]

in my View looping over the collection i get the title and template which is placed under templates folder.

what will be the way to get the contents of template in View

2
  • Possible duplicate of Load HTML template with JavaScript Commented Jan 24, 2017 at 16:22
  • Getting the content of the templates is irrelevant to Backbone. It's only about loading the content of a file, which has a lot of solutions. Commented Jan 24, 2017 at 16:22

1 Answer 1

0

There are many ways to do this. If you have minimal backbone setup you can use jQuery load method to retrieve the HTML content.

If you're using RequireJS then it has a text plugin, there are webpack modules that does this as well.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.