0
votes

I have been trying to learn Ember and have recently spent a lot of time referencing the Discourse code base over on github. Anyway, I wanted to implement something similar to their modal views method and don't understand why the currentViewBinding isn't working.

The following is combination of information referenced from these links:

App.HeaderController = Ember.Controller.extend
  templateName: 'application/header'
  needs: ['modal']

  toggleLogin: ->
    console.log "HeaderController.toggleLogin"
    @get('controllers.modal').show(App.LoginView.create())

App.ModalController = Ember.Controller.extend
  show: (view) ->
    @set('currentView', view)

App.ModalView = Ember.ContainerView
  currentViewBinding: 'controller.currentView'

  viewChanged: (->
    console.log "Modal view changed"
  ).observes('controller.currentView')

App.LoginView = Ember.View.extend
  templateName: 'modal/login'

My views essentially look like this:

<!-- application.hbs -->
{{render header}}
{{outlet}}

<!-- header.hbs -->
<button {{action toggleLogin}}>Login</button>
{{render modal}}

<!-- modal/login.hbs -->
<h2>Login Form!!</h2>

When the app initially loads, I get 2 console logs for "Modal view changed", when I click the {{action toggleLogin}} button in my header template, nothing happens except for the console message "HeaderController.toggleLogin".

What am I doing wrong or is this not how the Ember.ContainerView docs meant for it to work?

1
It looks like currentView is being set... but always remains in a preRender state. - bschaeffer

1 Answers

0
votes

Solved

Update from 1.0.0-rc.1 to 1.0.0-rc.2!