lkahtz
lkahtz

Reputation: 4796

Fail to load javascript template file using requireJS

The following code does not work:

define([
  'jquery',
  'lodash',
  'backbone',
  'mustache',
  'text!/app/js/templates/TreeCombo/TreeCombo.html' //Is this right?
  ], function($, _, Backbone, Mustache, MyTemplate){
 ...
})

I've got the following error messages in the console:

GET http://localhost:8888/app/js/text.js 404 (File not found) 

It seems the requireJS is not recognizing the "text!" tag.

Upvotes: 0

Views: 177

Answers (1)

Simon Boudrias
Simon Boudrias

Reputation: 44619

You need to include the "text" plugin within your project (and set up the path to it in the require.config if needed). It is not bundled in.

Upvotes: 1

Related Questions