Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Backbone.js 加载主干渲染函数时,字符串不是函数_Backbone.js_Backbone Routing - Fatal编程技术网

Backbone.js 加载主干渲染函数时,字符串不是函数

Backbone.js 加载主干渲染函数时,字符串不是函数,backbone.js,backbone-routing,Backbone.js,Backbone Routing,下面是在主干上实现的一段代码 new staffListViewN().render(qualifiedStaff,this.id) 我犯了这样的错误 “字符串不是函数” 下面是上述渲染函数的实现 staffListViewN = Backbone.View.extend({ el:'#staffs-list', render:function(stafflistParam,id) { var stafflist = stafflistParam;

下面是在主干上实现的一段代码

new staffListViewN().render(qualifiedStaff,this.id)

我犯了这样的错误

“字符串不是函数”

下面是上述渲染函数的实现

staffListViewN = Backbone.View.extend({
    el:'#staffs-list',
    render:function(stafflistParam,id)
    {
      var stafflist = stafflistParam;
      var ref = this;

      if(validate.variable(stafflist))
      {
        agentList = {agentList:stafflist};               
        ref.$el.html(staffListTemplate);
      }
     }
});

您是否知道您在哪一行收到错误?我猜validate.variable是一个字符串,您试图像调用函数一样调用它。但是当调用这行代码时。