问题
I would like to be able to swap views in a each helper using Ember.ContainerView.
{{#each itemController="person"}}
<li>{{view Ember.ContainerView currentViewBinding="cv"}}</li>
{{/each}}
It yields the following error:
Something you did caused a view to re-render after it rendered but before it was inserted into the DOM
It does work when I strip off the each helper.
I know there is other ways to do that but it seems to me that it's a good use case for a ContainerView.
Here is the jsFiddle : http://jsfiddle.net/fblanvil/Mr3D7/2/
回答1:
Something you did caused a view to re-render after it rendered but before it was inserted into the DOM
I found the problem, have a look at your modified and working jsfiddle.
Basically what you where doing wrong and thus the error was that you where calling create which should be rather extend.
See here for the changed part:
...
cv: Ember.View.extend({
templateName: 'name'
})
...
Hope it helps.
来源:https://stackoverflow.com/questions/17511964/error-while-using-currentview-feature-of-ember-containerview-in-an-each-helper