Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7660729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:30:19+00:00 2026-05-31T13:30:19+00:00

I have an Ember.Button which should remove an element from an array. The button

  • 0

I have an Ember.Button which should remove an element from an array. The button label is simply an X (for now).

I’d like to know the best way to store data for use by the button. If this was plain jquery I might use data-username. But what’s the best way to do this?

update
Use case for this question would be something like this:

{{#each App.recentUsersArray}}
    <li>
        {{#view App.RecentNameBtn contentBinding="this"}} {{content}} {{/view}}
        {{#view App.RecentNameDeleteBtn}}X{{/view}}
    </li>
{{/each}}

In the second view, I need a way to know which username the delete action should apply to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:30:19+00:00Added an answer on May 31, 2026 at 1:30 pm

    Use the {{action}} helper, which passes the context as argument, see http://jsfiddle.net/zVd9g/. Note: in the upcoming Ember.js version the action helper only passes one argument so you would have to adapt your sources accordingly.

    If you want to use your existing views, you could do a contentBinding="this" on the App.RecentNameDeleteBtn as you already did on the App.RecentNameBtn.

    Handlebars:

    <script type="text/x-handlebars" >
        {{#each App.arrayController}}
            <button {{action "showTweets" target="App.arrayController" }} >{{this}}</button>
            <button {{action "removeItem" target="App.arrayController" }}>x</button>
            <br/>            
        {{/each}}
    </script>​
    

    JavaScript:

    App = Ember.Application.create({});
    
    App.arrayController = Ember.ArrayProxy.create({
        content: [1, 2, 3, 4, 5, 6],
        removeItem: function(view, evt, item) {
            console.log('remove user %@'.fmt(item));
            this.removeObject(item);
        },
        showTweets: function(view, evt, item) {
            console.log('show tweets of user %@'.fmt(item));
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Flash/Flex object (Flashlight-VNC), which I would like to dynamically resize to
My main.xml layout simply contains a button and a LinearLayout content_area , which shows
Using Flex 3, I have a Button which is skinned using PNGs specified in
I have a little button on my page that should load a google map.
I have created one button component using one Bitmap and one Label in it.
I have the following controller which contains a view: Lead.Controllers.UrlSearch = Ember.Object.extend init: ->
Yes, I know you have to embed the google analytics javascript into your page.
I have an application that I would like to embed inside our companies CMS.
I have a menu like so: <div class=header> <ul class=nav> <li><a class=home href=four80eastfan_home.php><img src=Images/home_button.png></a></li>
I'd like an advice to the following problem: I want to embed a Button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.