Browse Source

Add `addAttributes` method in Component

pull/803/head
Artur Arseniev 8 years ago
parent
commit
d64db1e5f8
  1. 11
      src/dom_components/model/Component.js

11
src/dom_components/model/Component.js

@ -289,6 +289,17 @@ const Component = Backbone.Model.extend(Styleable).extend(
this.set('attributes', attrs);
},
/**
* Add attributes to the model
* @param {Object} attrs Key value attributes
* @example
* model.addAttributes({id: 'test'});
*/
addAttributes(attrs) {
const newAttrs = { ...this.getAttributes(), ...attrs };
this.setAttributes(newAttrs);
},
getStyle() {
const em = this.em;

Loading…
Cancel
Save