0

レンダリングしようとしていますが、javascript を完全には知りません。このエラーを比較してください: Uncaught ReferenceError: wrapper is not defined. コレクションのフェッチの結果を同じビューにレンダリングします。

     var HomeView = Backbone.View.extend({

 template: Handlebars.compile(template),

 events: {


  },

  initialize: function() {

      console.log("inhomeview");

      var amici = new Usercollection();
      amici.fetch({
      success: function() {
      amici.each(function(object) {

      console.log(object.toJSON());
      var wrapper=object.toJSON();



    });
   },
    error: function(amici, error) {
    // The collection could not be retrieved.
   }
       }); 

      this.render();

  },

   render: function() {

      var context=wrapper;
      var html =this.template(context);


      this.$el.html(html);


     return this;
     }



     });

    return HomeView;

      });    
4

1 に答える 1