简体   繁体   中英

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 ??

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 ).

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM