|
return new subview.constructor({ |
|
parent: self |
|
}); |
The auto-generated prepareView function does not provide an el argument to the constructor. As a result, the returned view instance's el may be undefined, causing container.appendChild(view.el) in renderSubview to fail. Is this a bug, or am I using it in a wrong way?
|
renderSubview: function (view, container) { |
|
if (typeof container === 'string') { |
|
container = this.query(container); |
|
} |
|
if (!container) container = this.el; |
|
this.registerSubview(view); |
|
view.render(); |
|
container.appendChild(view.el); |
|
return view; |
|
}, |
I found this issue when trying to use the example provided in ampersand-view's doc:
module.exports = AmpersandView.extend({
...
subviews: {
...
tab: {
hook: 'switcher',
constructor: ViewSwitcher
}
}
});
ampersand-view/ampersand-view.js
Lines 304 to 306 in beb1bdf
The auto-generated
prepareViewfunction does not provide anelargument to the constructor. As a result, the returned view instance'selmay beundefined, causingcontainer.appendChild(view.el)inrenderSubviewto fail. Is this a bug, or am I using it in a wrong way?ampersand-view/ampersand-view.js
Lines 221 to 230 in beb1bdf
I found this issue when trying to use the example provided in ampersand-view's doc: