title: Wrapper in Backbone View cannot be parametrized in order to work with d3.js
body: <p>I have encountered something and I don't understand it. I'm having a Backbone.View - lets say A - and inside of the initialize statement I'm loading another View that is wrapper - lets say B - in which I'm executing some d3js code. However, I'm loading the topview object (app) inside of A so the view with cid = "view1". </p>
  
  <pre><code>define([], function(){
     return Backbone.View.extend({
        initialize: function(app, options) {
           this.app = app;
           this.setElement($(this._tmpl()));
  
           require(['someurl/wrapper'], function(wrapper){
              this.wrapper = new wrapper(app);
           })
      },
  
      _tmpl: function() {
         return '&lt;div id="d3jsview"&gt;'+'&lt;/div&gt;';
      }
    });
  });
  </code></pre>
  
  <p>And the wrapper looks like this.</p>
  
  <pre><code>define([], function() {
     return Backbone.View.extend({
        el: "#d3jsview",
        initialize: function(app, options) {
           this.app = app;
           this.render();
        },
  
        render: function() {
           var w = 640, h = 480;
           var svg = d3.select(this.el)
                  .append("svg")
                  .attr("width", w)
                  .attr("height", h);
        }
     })
  })
  </code></pre>
  
  <p>So when I call the wrapper with new wrapper(app) the d3js code is not working. Without it new wrapper() it works. However, I need to access the model inside of app. What am I missing. Thanks in advance.</p>