0
<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');
    }
});

ボタンをクリックすると、アクションがアラートを呼び出すことはありません。ここで何が問題になっていますか。コンパイルにember-skeletonを使用しています。

4

1 に答える 1

2

犯人を見つけた。私のApp.createにはinitというメソッドがあります。名前を別の名前に変更しましたが、正常に機能するようになりました。私はスーパーとは呼ばなかった。

于 2012-07-07T11:34:02.520 に答える