The application Cordova / phonegap with yeoman / backbone / handlebars / require

advertisements

I've tried to follow this tutorials:

to develop my test cordova application with yeoman and backbone...I've followed all steps but when I've tried to insert my first view the console gives me error about template...I'm novice in this and I don't understand where I wrong.

If I execute the code in my app source the console error is:

**GET http://localhost:8888/LABS_and_TRAINING/TEST/pgyo-test03/PgYoTest/src/app/scripts/templates.js 404 (Not Found) require.js:1880
Uncaught Error: Script error for: templates
http://requirejs.org/docs/errors.html#scripterror require.js:163**

If I execute the code in the dist, the error is:

**Uncaught TypeError: Cannot call method 'template' of undefined**

Here you can download the src(without the node modules) https://dl.dropboxusercontent.com/u/2637840/src.zip


I was only receiving the "Cannot call method 'template' of undefined" error when viewing dist build. I came across the solution, but am not sure why it works.

Your RequireJS Shim for Handlebars should look like this

shim: {
  handlebars: {
    exports: 'Handlebars',
    init: function() {
      this.Handlebars = Handlebars;
      return this.Handlebars;
    }
  }
}

This solution is still being discussed, but it works for now.