ember js view error Uncaught TypeError:string不是函数

时间:2012-04-09 14:58:24

标签: ember.js

目前我有这段代码

var App = Ember.Application.create();

App.user = Ember.Object.create({
  people: customers
});

App.editRowView = Ember.View.create({
  template:"editRowModal"
});

App.userView = Ember.View.extend({
  edit:function(e){
    console.log(this.content.id);
    App.editRowView.append();
  }
});

我的观点如下

<script type="text/x-handlebars" data-template-name="editRowModal">
    <div class="modalBox" id="modalBox">
        <span class="sprite closeToolTip"></span>
        <h4>Restart</h4>
        <div class="cont">

        </div>
        <div class="actions">
            <a class="cancelSendNotification">cancel</a>
            <a class="primary" id="restartCustomer">ok</a>
        </div>
    </div>
</script>

我在页面上有一个按钮,其点击时绑定了编辑属性。每次我点击按钮我都可以在console.log中查看我的模型的ID,但我似乎无法在dom中显示我的视图。我不确定发生了什么,因为我的App.editRowView.template是我的视图模板的data-template-name属性的pointint,理论上它应该绑定...任何线索?

1 个答案:

答案 0 :(得分:4)

尝试更改

App.editRowView = Ember.View.create({
  template:"editRowModal"
});

App.editRowView = Ember.View.create({
  templateName:"editRowModal"
});