English 中文(简体)
Ember statemanager, Controller, view, model : 如何将它们联系起来?
原标题:Ember statemanager, controller, view, model : how to link them together?
  • 时间:2012-05-05 07:26:22
  •  标签:
  • ember.js

我面临一个问题,即我需要把国家管理人员、控制者联系起来,并共同看待这一问题,同时避免出现一种丑恶的传闻。 问题在于:应当首先确定哪一个目标,并有责任创造其他目标?

具体来说,我就是例子。 首先,这种观点是集装箱观点的一个子类,其收集视儿童为:

App.MyView = Ember.ContainerView.extend {

     childViews: [ streamView ]

     streamView: Ember.CollectionView.extend {
     }

}

管制人员也属于黑白。 装载方法:

App.MyController = Ember.ArrayController.extend {
     load: ->
        console.log "loading data"
}

国家管理人员有这样的观点,即时提出申请。 我的意见:

App.MyStateManager = Ember.StateManager.extend {

   initialeState:  ready 

   ready: Ember.ViewState.extend {

        view: App.MyView    

   }
}

现在我需要做以下试验:

 controller = App.MyController.create {}
 manager = App.MyStateManager.create {}

 expect(manager.getPath( currentState.name ).toEqual( ready )
 expect(controller.load).toHaveBeenCalled()
 streamView = manager.getPath( currentState.view.streamView.content )
 expect(streamView.content).toEqual(controller.content)

为了使最后的希望能够奏效,我需要约束我作为上诉儿童的意见的内容。 我对控制器内容的意见。 我怎么能够这样做?

此外,如何提及国家管理人员和控制人员,以便在发生某些事件时通知管理人员,以便它需要过境到另一个国家。 例如,点击某一物品或控制器确实完成了工作?

问题回答

Take a look at this gist by Yehuda Katz discussing the new router implementation. https://gist.github.com/2728699

该建议似乎是为了使路线者,并进而使国家管理人员成为三层连接点。





相关问题
Are Recursive Collections possible in sproutcore2?

I have a customizable navigation tree that can be nested 3 levels deep. Templates: <script type="text/x-handlebars" data-template-name="NavItemView"> <a {{bindAttr href="href" class="...

ember.js widgets

I know that ember js is good for single page apps and it appears that you can localize ember js app to a single dom container rather than the whole page, so I m wondering if ember js would be a good ...

Ember.js binding models stored within an array

What is the correct way to bind from one model to another when the models are stored within an array? Typically I d imagine that this would be a Controller s content array, but to keep the example ...

rendering views dynamically on EmberJS

I just having a little trouble to implement a special kind of view for Ember, I m digging on the source for days but can t find how to make it work... Can you take a look and tell me what s wrong? It ...

热门标签