0

我正在关注本教程http://www.adobe.com/devnet/html5/articles/flame-on-a-beginners-guide-to-emberjs.html

并且无法显示 ReviewTextArea 视图。

到目前为止,我的代码是:

索引.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>

应用程序.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 ...}} 标记(使用 Inspect Element)。

关于为什么这不起作用的任何想法?

4

1 回答 1

2

您的代码中有错误 - 未定义歌曲。

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

它应该是Songs.Song

于 2012-10-10T09:27:54.890 回答