初めて Ember.js アプリケーションを作成しましたが、正しく動作しません。
私の index.html
<script type="text/x-handlebars">
{{#if Songs.totalReviews}}
Read all my {{Songs.totalReviews}} reviews!
{{else}}
There are no reviews right now.
{{/if}}
{{#each Songs.songsController}}
<h3>{{title}}</h3>
<p>{{artist}} - {{genre}}</p>
{{/each}}
</script>
</body>
</html>
私のapp.js
Songs = Ember.Application.create({
mixmaster: 'Andy',
totalReviews: 1,
ready: function(){
alert('Ember sings helloooooooooo!');
}
});
Songs.Song = Ember.Object.extend({
title: null,
artist: null,
genre: null,
listens: 0
});
mySong = Song.create({
title: 'Son of the Morning',
artist: 'Oh, Sleeper',
genre: 'Screamo'
});
Songs.songsController = Ember.ArrayController.create({
content: [],
init: function(){
// create an instance of the Song model
var song = Songs.Song.create({
title: 'Son of the Morning',
artist: 'Oh, Sleeper',
genre: 'Screamo'
});
this.pushObject(song);
}
});
しかし、このページを開くと、
Read all my 1 reviews!
曲の並びはどうですか?私はそれを間違った方法で構築しましたか?