Quantcast
Viewing all articles
Browse latest Browse all 3491

Re : Can.view Deferred getting resolved after controller has been destroyed

I've not used the proxy() method before but one way I got around this problem was to keep deferreds out of render() and only call render() inside of the done() callback of the deferred.

  1. can.Control('MyControl', {}, {
  2.       init: function() {
  3.             var self = this;

  4.             this.options.data.done(function(data) {
  5.                   self.deferredData = data;
  6.                   self.render();
  7.             });
  8.       },
  9.       render: function() {
  10.             this.element.html(can.view('myView.ejs', this.deferredData));
  11.       }
  12. });

Viewing all articles
Browse latest Browse all 3491

Trending Articles