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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.