I have a custom model attr (similar to what ships with ember-data)
var attr = function() {
var value = '';
return function(key, val) {
if (arguments.length === 2) {
value = val;
}
return value;
}.property()
};
I annotate my model properties with it like so
var Foo = Ember.Object.extend({
firstName: attr()
});
What I'm looking for is a way to get "only" these attrs when I loop through the "keys" on this instance (example -in my rollback method I want to reset each of these - but no other keys should be reset)
var Foo = Ember.Object.extend({
firstName: attr(),
rollback: function() {
for(var key in this){
this.set(key, "some value here");
}
}
});
It it possible to make this attr special in some way so I can loop over only those attribues on the model?
Aucun commentaire:
Enregistrer un commentaire