I recently switched from corner fire from 0.6 to 0.8. I'm having trouble saving the list item that contains the array itself.
My account objects are as follows:
{
"-JQruasomekeys0nrXxH" : {
"created" : "2014-03-23T22:00:10.176Z",
"durations" : [ {
"$$hashKey": "00L", // this is generated by ng-repeat on arrays
"end" : "2014-07-15T22:00:00.000Z",
"start" : "2014-07-09T22:00:00.000Z"
} ],
"email" : "some@mail.net",
}
}
Duration is an array of time periods from the beginning and the end that resemble the ng repeat of two input fields in HTML.
<tr ng-repeat="duration in account.durations">
<td>
<input ng-model="duration.start" datepicker>
</td>
<td>
<input ng-model="duration.end" datepicker>
</td>
</tr>
Before saving the account in firebase, I do angular.copy ($ scope.account) in the controller to get rid of the hash values of angular $$. This worked in angularfire 0.6.0.
In angularfire 0.8.0, I still get the error:
: Firebase.set: ($$ hashKey) 'durations.0'. ".", "#", "$", "/", "[", "]
, ? , . , angular.copy firebase angularfire?
.
(11 . 14)
, , angular.copy() . . / $save() (https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-firebaseobject-save) $save() angular.copy().
2 (12 14)
, :
angular.forEach($scope.account.durations, function (value, index) {
var cleanValue = {};
if (typeof value.start === 'string') {
cleanValue.start = value.start;
} else {
cleanValue.start = value.start.toJSON();
}
if (typeof value.end === 'string') {
cleanValue.end = value.end;
} else {
cleanValue.end = value.end.toJSON();
}
$scope.account.durations[index] = cleanValue;
});
, , , Firebase, , AngularFire.
3 (13. AUg 14)
jsfiddle, : jsfiddle.net/1fem6byt
, firebase, $$ hashKey ( ). , , , . , - - ?