余烬 JS 中的操作帮助程序不调用函数


<a class="btn btn-primary" href="#" {{action "toggleStatus"}}><i class="icon-plus icon-white"></i> Add Staff</a>

这是在一个名为stafflist.handlebars的视图模板中。内容如下

<div class="page-header">
    <h3>{{staff.title}} <small>List of users who has access to this application</small></h3>
  </div>
<div class="commands pull-right">
sta
<a class="btn btn-primary" href="#" {{action "toggleStatus"}}><i class="icon-user icon-white"></i> {{staff.btnTitle}}</a>
</div>
<div class="pull-left">
<input type="text" class="search-query" placeholder="Search">
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<td>NAME</td>
<td>ID</td>
</tr>
<thead>
<tbody>
{{#each staff}}
<tr>
<td>{{this.fname}}</td>
<td>{{this.id}}</td>
</tr>
{{/each}}
</tbody>
</table>

视图文件如下所示

App.StaffListView = Em.View.extend({
    templateName:'sellap-web/~templates/stafflist',
    staffBinding:'App.staffController',
    toggleStatus: function() {
        alert('Hurray');
    }
});

单击该按钮时,操作永远不会调用警报。这里出了什么问题。我正在使用余烬骨架进行编译。

找到了罪魁祸首。My App.create 有一个名为 init 的方法。我将名称更改为其他名称,现在它工作正常。我没有打电话给超级。

最新更新