Attach an event to a state method


#1

Hi,

I’m trying to set up a very basic StateManager to handle the communication with the backend and at the moment I’m stuck with one thing:

CashStateManager = Ember.StateManager.create
  initialState: 'cash'
  cash: Ember.State.create({})
  sentToServer: Ember.State.create({})
  saved:  Ember.State.create({})

CashStateManager.on "sentToServer", ->
  alert 'Data sent to server !'

CashStateManager.transitionTo('sentToServer')

Once the state becomes ‘sentToServer’ it should fire my event, but nothing happens. Any clue ?? :blush: