简体   繁体   中英

Issue adding action helper in Ember.js to dynamic content

I want to use an action helper on content that is being dynamically generated. I'm pulling data in and creating rows of records. Each record has an edit and delete button being added to it. The purpose is to monitor an event and pass it to the router. In another instance I have an event -> disableScroll being monitored when a user goes to enter a new record. This successfully executes as it's wrapped within:

<script type="text/x-handlebars" data-template-name="form">
    <a href="#new-record" {{action "disableScroll" on="click"}}>New Record</a>    

     ....
     ....
     ....
</script>

I want to replicate this with n number of edit buttons. The edit button is being appended to the data brought in by the model and pushed as a new field in the record.

row.push("<a href='#edit-record' id='"+variable+"'>Edit Record</a>"); 

我通过在用户单击视图中的按钮时向路由器发送事件来解决问题,而不是尝试在模板中附加动作帮助器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM