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

  • Home
  • SEARCH
  • 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 7885123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:58:49+00:00 2026-06-03T04:58:49+00:00

Imagine I create an ember object, then add it to an arbitrary unknown number

  • 0

Imagine I create an ember object, then add it to an arbitrary unknown number of array controllers. Is there a simple way of destroying the object so that all the array controllers get notified and remove it?

http://jsfiddle.net/FcsRP/

destroy from Ember.CoreObject doesn’t seem to notify the collections that their objects have been destroyed, or the collections don’t remove their objects. I’m not even sure if they’re meant to or not.

  • 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-06-03T04:58:50+00:00Added an answer on June 3, 2026 at 4:58 am

    The easiest way that I can think of is adding an observer on the object’s isDestroyed property. That way when you destroy something and that property becomes true you can run whatever code you need to.

    See this jsfiddle: http://jsfiddle.net/ud3323/FSCyF/

    Code:

    obj = Ember.Object.create({});
    
    a1 = Ember.ArrayController.create({
        content: [],
        destroyedObj: function() {
            alert('destroyed obj observer in a1');
      }.observes('content.@each.isDestroyed')
    });
    a2 = Ember.ArrayController.create({
        content: [],
        destroyedObj: function() {
            alert('destroyed obj observer in a2');
      }.observes('content.@each.isDestroyed')
    });
    
    a1.pushObject(obj);
    a1.pushObject(obj);
    a2.pushObject(obj);
    
    obj.destroy()
    
    alert(a1.get('content').length)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine that I want to create an array from another array like this: $array
Imagine this Script: var s = TStrings.Create; s.Add('Line 1'); s.Add('Line 2'); procedure MyProc; begin
Let's imagine I have Fraction class. So, the correct way to create instance of
Imagine a table emp : CREATE TABLE emp ( id NUMBER , name VARCHAR
Imagine an interface with a method to create objects of type Address . The
Imagine some kind of a banking application, with a screen to create accounts. Each
I want to create a helper method that I can imagine has a signature
Imagine I wish to create (or overwrite) the following file :- C:\Temp\Bar\Foo\Test.txt Using the
Imagine to have a table defined as CREATE TABLE [dbo].[Price]( [ID] [int] NOT NULL,
Imagine a table that looks like this: CREATE TABLE [dbo].[test]( [id] [uniqueidentifier] NULL, [name]

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.