我正在尝试将JSON对象的元素更新为该JSON对象中的对象。
var storedObj = $storage("storedObj").get();
返回类似这样的内容
storedObj = {
businessID: 1234,
businessName: Some Business,
businessAddress: null
}
我想更新businessAddress并在本地重新保存对象。
var bizAddress = {
city: "City Name",
state: "State Name",
Zip: "12345"
}
我尝试了这个并且没有用
storedObj.businessAddress = bizAddress;
$storage("storedObj").set(storedObj);
理想情况下,这将使用更新的节点恢复整个对象。
答案 0 :(得分:1)
可能是
的becozbusinessName: Some Business, // Supposed to be
businessName: 'Some Business', // Encased in Quotes