Issue #1385Opened August 27, 2018by ionic6660 reactions

about the use of setAttributes

Question

hi,I saved an object in the custom property。 2018-08-27_145924 And I want to implement putting values into custom properties。 2018-08-27_150059 but It will cover the previous one 2018-08-27_150154 2018-08-27_150211

Answers (3)

arthuralmeidapAugust 30, 20180 reactions

so, in the second case do you want to update the same data-info attribute with a new key, right?

since data-info has a string as a type value, first you need to get it and parse to an object.

const dataInfoObject = JSON.parse(this.model.get('data-info'))

after that, you can update the object with the new key

dataInfoObject[newKey] = newValue

and then you change it back to string and replace the attribute value for your model

this.model.set('data-info', JSON.stringfy(dataInfoObject))

let me know if it works

artfAugust 31, 20180 reactions

I thinks he's just looking for addAttributes

lock[bot]September 17, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.