While working with AngularJS, I encountered an issue when trying to insert a new value into an existing JSON object. The error message I received was:
"Object doesn't support property or method 'push'"
Below is the code snippet I am using:
$scope.addStatus = function (text) {
$scope.application.push({ 'status': text }); //I attempted 'put' but encountered an error
};
$scope.create = function( application ){
$scope.addStatus('Under review');
}
This is what my application JSON looks like:
{"type":"Not completed","source":"mail","number":"123-23-4231","amount":"234.44","name":"John ","id":"123","by_phone":true}
The goal is to add/append a status to the above JSON so it resembles this after adding the status property:
{"type":"Not completed","source":"mail","number":"123-23-4231","amount":"234.44","name":"John ","id":"123","by_phone":true, "status": "under review"}