2014-10-10 67 views
0

所以,我有这样的代码:ember.js Ember.Select抛出错误“无法读取属性‘的selectedIndex’的未定义”

{{#if isClient}} 
    {{view Ember.Select 
      value=country 
      content=options.country 
      prompt='Please select a country'}} 
{{/if}} 

它可以在负载奇妙的作品,因为isClient默认为true。但是,当我设置isCLient为假,我得到这个错误:

Cannot read property 'selectedIndex' of undefined 

任何人都更好地了解底层代码这里有什么想法?

+0

您是否试图从代码中的其他位置选择菜单中读取值? – Dhaulagiri 2014-10-10 22:52:12

回答

0

好的,所以我找出了问题所在。

我用的余烬,动画库,并呼吁:

Ember.View.reopen({ 
    willAnimateIn: function() { 
     this.$().hide(); 
    }, 
    animateIn: function (done) { 
     this.$().fadeIn(250, done); 
    }, 
    animateOut: function (done) { 
     this.$().fadeOut(250, done); 
    }, 
}); 

由于Ember.Select是一个观点,当它应该出现和消失都被称为动画功能。所以,我只是将上面的内容更改为:

Ember.AnimatedView = Ember.View.extend({ 

而且一切都很好。

相关问题