Ember.js dynamic child views

2019-05-10 15:40发布

问题:

I'm having trouble getting ember to render a dynamic child view. It seems that once the child view is rendered, the binding is lost. Here's a jsfiddle

http://jsfiddle.net/zaius/XYzfa/

As you click between the two editor pages, the child view remains on the first view that was rendered. Is there a way to tell ember to refresh the view, or am I going about this completely the wrong way?

I'm brand new to ember, so any general feedback on my code is welcome too.

回答1:

You should consider using Ember.ContainerView (see documentation) for such dynamic content.

Illustrating JSFiddle here (I also refactored your code a little to be more idiomatic).