EmberJS Set Multiple Properties At Once

后端 未结 2 1268
小鲜肉
小鲜肉 2021-02-05 02:06

I am setting lots of properties with a series of set calls e.g.

this.set(\'prop1\', value1);
this.set(\'prop2\', value2);
.......

Is there a wa

2条回答
  •  你的背包
    2021-02-05 02:20

    There is actually a function for this: setProperties. You can use it like this:

    obj.setProperties({prop1: value1, prop2: value2})
    

    obj should be instance of Ember.Object.

提交回复
热议问题