Skip to content

JSON objects #28

@rmckeel

Description

@rmckeel

Using a Sails model "item" that specifies "runtimeData" as a JSON object, I have not been able to get this to work when runtimeData is already set to a value. For instance, given this data existent in the MongoDB data store:

$scope.items[0].runtimeData = { "currentVal": 1 };

The following does not trigger an update:
$scope.items[0].runtimeData.currentVal = 2;

And this rarely / unreliably triggers an update:
$scope.items[0].runtimeData = { "currentVal" : 2 };

But this always triggers:
$scope.items[0].runtimeData = { "lastUpdate" : new Date().getTime(), "currentVal" : 2 };

It seems that a combination of changing the entire runtimeData object AND including a value is what is causing the update to be performed properly. All bindings at the root level ($scope.items[0].customVal = "5") work great at mirroring back to the database.

Any ideas? I haven't dived into the code enough to know how to fix, and I am new to Angular.

Thanks!

Ryan

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions