Is there something I don't understand or have I encountered a bug?
isCreator: Ember.computed.equal('session.user.id', 'model.user.id'), //false
isCreator2: Ember.computed('session.user.id','model.user.id', function() { //true
return this.get('session.user.id') === this.get('model.user.id');
}),
Ember.computed.equal
doesn't take two property keys, it takes one property key and one constant value. Taken from the documentation:
A computed property that returns true if the provided dependent property is equal to the given value.
If you want to compare two different properties you'll have to write the computed property manually like you've done with idCreator2
.
You can use ember-awesome-macro's equal instead, which takes two property keys. See https://github.com/kellyselden/ember-awesome-macros#equal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With