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

Ember.computed - make property immutable

$
0
0

@Riz wrote:

Hi all,

it seems like this is something simple but im not able to find a straight forward solution to it.Any help is greatly appreciated.

I have the below function which works fine.. but I need to add a property so I can save the original state of the array. I have put it below just to show a small visual of what I need, I understand the syntax and approach is wrong. Basically I need to copy the billing array to a new array where it wont be binded by the original computed value anymore. I hope I have described it properly.

billingContacts: Ember.computed('notifications', function() {
var notifications = this.get('notifications');
var billing = [];
var newBilling = billing;
if (notifications) {

        billing = notifications.find(function(item) {
            return /billing/i.test(item.name);
        });
    }
    return billing;
}),

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles