ember.js - Ember refresh models from another controller -


i have applicationcontroller in when "ember.select" change value want refresh models.

app.applicationcontroller = ember.objectcontroller.extend({ needs: ['abstractauth', 'widgets', 'modalwindows', 'chatcompose', 'chatmodal', 'about', 'contacts'], selecteddomainalias: {}, selecteddefaultvalue: { id: 2 },  onselecteddomainaliaschange: function () {     var self = this;     var getselecteddomain = this.get("selecteddomainalias.domainname");     $.get('/setcookies/cookies?domains=' + getselecteddomain, false)         .then(function() {             self.send("domainchanged");             self.get('model').reload();             var contacts = app.controllerfor('contacts').store.find('contact');             self.get('controllers.contacts').set('model', contacts);         }); }.observes('selecteddomainalias.length')}); 

self.send("domainchanged") , self.get('model').reload() work correctly.

i have model "contact", should refresh. app.controllerfor('contacts').store.find('contact') - receives model backend. couldn't refresh correctly "contact" model.

if @ first have 2 contacts in model. , when try replace 2 contacts per 1 contact, contact added third contact, want 1 contact. how can refresh "contact" model correctly?

find method returns promise, in then method.

var contacts = app.controllerfor('contacts').store.find('contact').then(function(result){  self.get('controllers.contacts').set('model', result); }); 

currently find private method.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -