javascript - Backbone.js View not rendering my json file -


After

I am new to backbone.js and want to keep a json file called, products.json .

Products have been loaded into the archive, but it has not been render only. Send me the render () function & amp; Underscore.js.

If someone can help me, thanks!

In your ShopView list, an audience for the 'Reset' event , So when the scene is stored the view will be re-provided.

  initialize: function () {_.bindAll (this, 'render'); This.collection = New Shoplist (); This.listenTo (this.collection, 'reset', this.render, this); This.collection.fetch ({reset: true}); // check url path this.render (); } Render: function () {var self = this; This.collection.each (function (item) {var view = new ProductItemView ({model: items}); $ (self.el) .append (view.render ());}); This return; }   

To present the model, you will need to change the template to look like this:

    

and ProductItemView :

  render: function ($ {$ (this.el) .html ( This.template (this.model.toJSON ())); This return; }    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -