Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4831

Pass object by reference to other objects

$
0
0

@Charles_Bourasseau wrote:

Is that possible to pass property by references to other object.

Something to achieve this:

import EmberObject from '@ember/object';

const Person = EmberObject.extend();

let personA = Person.create();
let personB = Person.create();

personA.set('foo', 'bar');
personB.set('foo', personA.getReference('foo'));

personA.get('foo'); // bar
personB.get('foo'); // bar

personA.set('foo', 'baz');

personA.get('foo'); // baz
personB.get('foo'); // baz

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4831

Trending Articles