Foysal Vai
Foysal Vai

Reputation: 1363

Use external file for templating in backbonejs

I would like to use external file for templating in backbonejs. I searched in google but could not find any suitable solution.

Could anyone say how to do that ??

Upvotes: 0

Views: 81

Answers (2)

Murthy
Murthy

Reputation: 387

Try declaring the templates in a new jsp file and include it in main jsp file. The backbonejs view declared for main jsp can render these new templates.

Upvotes: 1

Chetan S
Chetan S

Reputation: 23803

By external file, you mean storing the template in html files and read it? If so, you need one of the module loaders such as RequireJS (See the requirejs text plugin) or browserify (with the stringify middleware).

Upvotes: 1

Related Questions