Closed amankapur closed 10 years ago
var foo = "apple"; var model = new Model({ name: 'test', bar: { apple: 1, banana: 2 } })
model.set('bar[foo]', 'orange') fails. and so does model.remove('bar[foo]')
model.set('bar[foo]', 'orange')
model.remove('bar[foo]')
I understand that is tricky and is getting into string pramming limitations, but is there a simple workaround?
thanks
get is easier model.get('bar')[foo]
model.get('bar')[foo]
Did you mean model.set('bar[' + foo + ']', 'orange')?
model.set('bar[' + foo + ']', 'orange')
(derp)
model.set('bar[foo]', 'orange')
fails. and so doesmodel.remove('bar[foo]')
I understand that is tricky and is getting into string pramming limitations, but is there a simple workaround?
thanks