2012-10-10 50 views
0

我下面這個教程http://www.adobe.com/devnet/html5/articles/flame-on-a-beginners-guide-to-emberjs.html灰燼視圖中不顯示

,並無法獲得ReviewTextArea視圖中顯示。

到目前爲止我的代碼是:

的index.html

<html> 
<head> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
    <script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-0.9.6.min.js"></script> 
    <script src="js/app.js"></script> 
</head> 
<body> 

<script type="text/x-handlebars"> 
    Hello <b>{{Songs.mixmaster}}</b> 
</script> 

<script type="text/x-handlebars"> 
    {{view Songs.ReviewTextArea}} 
</script> 

</body> 
</html> 

app.js

Songs = Em.Application.create({ 
    mixmaster: 'Andy', 
    totalReviews: 0, 
    ready: function() { 
     alert('Ember sings helloooo'); 
    } 
}); 

Songs.Song = Em.Object.extend({ 
    title: null, 
    artist: null, 
    genre: null, 
    listens: 0 
}); 


mySong = Song.create({ 
    title: 'Son of the Morning', 
    artist: 'Oh, Sleeper', 
    genre: 'Screamo' 
}); 


Songs.ReviewTextArea = Em.TextArea.extend({ 
    placeholder: 'Enter your review', 
}); 

但是我的瀏覽器(Chrome 22.0.1229.92)只顯示原始{{view ...}}標籤(使用檢查元素)。

任何想法,爲什麼這不工作?

+0

控制檯是否顯示錯誤?如果你能把這個例子放在jsfiddle中,那會很好。 –

+1

它與ember-1.0.pre.js一起工作,請參閱JSFiddle:http://jsfiddle.net/rJEND/ – louiscoquio

+0

@louiscoquio你在你的小提琴中修復了一個錯誤;)...哇這已經被回答了;)文章包含一個「coquille」:p –

回答

2

代碼中有錯誤 - 未定義歌曲。

mySong = Song.create({ 
    title: 'Son of the Morning', 
    artist: 'Oh, Sleeper', 
    genre: 'Screamo' 
}); 

它應該是Songs.Song