mardi 11 avril 2017

Problems with rebinding model to a list the second time in ember.js

I am new to Ember and I am trying to make a simple demo app where a list gets rerendered with differrent data when a button is pressed.

Here is a running example of my attempt, by pressing SHOW LIST button a tweet list is shown, and the binding works fine for the first time: http://ift.tt/2oofAsS

Below are the two places in the code where I've tried to rebind the model to the list:

1)in ApplicationController - I tried to bind the bindNewModel action to the MODIFY button, but it doesn't seem to be working.

2)in ListController - tried to bind bindNewModel action to all the list items(when any list item is pressed), but also that does not seem to work.

    App.ApplicationController = Ember.ObjectController.extend({
            actions: {
                bindNewModel: function() {
                    console.log(App.ListController);
                    this.set('model', renderTweets());
                }
            }
        });

    App.ListController = Em.ArrayController.extend({
            init: function() {
                this.set('model', renderTweets());
            },
            actions: {
                bindNewModel: function() {
                    this.set('model', renderTweets());
                }
            }
        });

Any help would be appreaciated.




Aucun commentaire:

Enregistrer un commentaire