Skip to content

mike-tuxedo/ember-starterkit-with-outsourced-templates

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ember-starterkit-with-outsourced-templates

I searched a long time for a easy solution to get embers templates out of the index.html. Now this is the standard ember-starter-kit with the easiest modification I could find to do this.

Under the templates-folder you have all templates as html-files and under the js-folder you can find the templateLoader.js, were you have to specify what templates should be loaded.

Example:

We have a template like ../templates/myTemplate.html with content.

`

hello world

`

Then you will have to add the following line in templateLoader.js to load it on startup.

` $.ajax({url: 'templates/myTemplate.html', success: function(data){addTemplate(data, 'templatename in ember');}, async: false }); `

which is the same as if you wrote it in index.html like ...

` <script type="text/x-handlebars" data-template-name="index">

hello world

</script> `

As i wrote, it is realy easy, but i couldn't find that solution anywhere on the internet, so i thought i should fork a little example for beginners and anyone who has the same problem as i had.

I can not guarantee that it is a good solution, but for me it worked perfectly.

Have fun with it!

About

A starter kit for Ember with extern templates

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%