2013-04-29 80 views
0

我我developying通过骨干网的应用程序,但现在出去了同样的错误:错误骨干

Uncaught TypeError: Object function(){ parent.apply(this, arguments); } has no method 'match'

此错误开始出来的时候我已经添加了调用新Signupview:

define(["jQuery", "underscore", "Backbone", "Handlebars", "models/person", "views/signupview", "text!templates/loginview.html"], function ($, _, Backbone, Handlebars, Signupview, template) { 
    var LoginView = Backbone.View.extend({ 
     template: Handlebars.compile(template), 
     events: { 
      "click .sign_up": "signUp_manual" 
     }, 
     initialize: function() { 
      this.render(); 
     }, 
     render: function() { 
      var html = this.template(); 
      $('#pagina').html(this.$el.html(html)); //appendo ad el); 
      return this; 
     }, 
     signUp_manual: function() { 
      console.log("signup"); 
      new Signupview(); 
     } 
     //inserire funzione per log-in 
    }); 
    return LoginView; 
}); 

而这里Signupview:

define(["jQuery", "underscore", "Backbone", "Handlebars", "text!templates/signup.html"], function ($, _, Backbone, Handlebars, template) { 
    var Signupview = Backbone.View.extend({ 
     template: Handlebars.compile(template), 
     events: {}, 
     initialize: function() { 
      this.render(); 
     }, 
     render: function() { 
      var html = this.template(); 
      $('#pagina').html(this.$el.html(html)); //appendo ad el); 
      return this; 
     } 
    }); 
    return Signupview; 
}); 
+1

错误显然不从发布代码干PersonModel说法。请查看其行号,并向我们介绍相关的代码。 – Bergi 2013-04-29 20:17:10

+0

handlebars.js line 366 – 2013-04-29 20:25:45

+0

match = this._input.match(this.rules [rules [i]]); – 2013-04-29 20:30:28

回答

1

问题是从这一行来,

​​

,你错过了在回调函数