0
我使用的是containerview,我使用currentview財產動態添加和刪除上下文的形式,有點像這樣:ember.js containerview涉及
showSomeForm: ->
form = @get('theContainerView')
if form.get('currentView')
form.set('currentView', null)
contextualForm = App.Form.create
controller: App.Controller.create()
showSomeOtherForm: ->
form = @get('theContainerView')
我擔心的就是內存泄漏,每次創建控制器如果這是做事的最佳方式。
一旦用戶完成了上下文形式,我還將currentView設置爲null以隱藏它。
有沒有更好的方法來做到這一點,我目前在ember v1.0.0-pre.2-54。