EmberJS: contentBinding not working
EmberJS: contentBinding not working
这里出了什么问题?为什么视图中的contentBinding不起作用?
输出
视图中的内容未定义
router.coffee
App.Router.map ->
@route "show"
@route "intro",
intro_controller.coffee
App.IntroController = Ember.ArrayController.extend
content: []
createRecords:(files) ->
@set('content', Ember.A())
person = Ember.Object.create(username: "hello world")
@pushObject person
console.info "content in controller", @get('content')
@transitionTo 'show'
show_view.coffee
App.ShowView = Ember.View.extend
contentBinding: 'App.IntroController.content',
didInsertElement: ->
console.info "content in view", @get('content')
App.IntroController
是Ember.Object
的子类,而不是实例。
您需要一个指定需要什么的App.ShowController
:
App.ShowController = Ember.Controller.extend({
needs: ['intro']
});
然后在视图中,您将可以访问:controllers.intro.content
。
相关文章:
- $rootScope not working
- jQuery document.ready not working
- Javascript getElementsByTagName not working?
- JQuery.val( ) not working
- Tomcat websocket is not working
- Javascript JSON.parse not working
- NodeJS Multer is not working
- Regex not working
- Ember run.debounce not working
- AngularJs 1 not working
- document.getElementById.style.backgroundImage not working
- Rxjs5, distinct() is not working
- createOscillator noteOn not working
- Javascript - .getHours() not working
- Javascript setTimeout not working | onkeydown
- MongoDB $pull not working
- Express router.use not working
- JSONP not working
- window.opener not working in chrome & IE
- Backbone + RequireJS: Collection.each() is not working