diegopamio / diegopamio/angular-sails-bind

JSON objects

Open
#28 2 comments 0 reactions 0 assignees View on GitHub
0 - Backlog
Dominant language
JavaScript
Stars
135
Forks
23
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.