javascript - "Object doesn't support property or method 'push'" -
javascript - "Object doesn't support property or method 'push'" -
this question has reply here:
javascript object push() function 6 answersi'm trying add together new value existing json object in angularjs i'm getting error message:
"object doesn't back upwards property or method 'push'"
here code:
$scope.addstatus = function (text) { $scope.application.push({ 'status': text }); //i have tried 'put' getting error }; $scope.create = function( application ){ $scope.addstatus('under review'); }
here application json looks like:
{"type":"not completed","source":"mail","number":"123-23-4231","amount":"234.44","name":"john ","id":"123","by_phone":true}
i want append/add status above json , looks after adding status property:
{"type":"not completed","source":"mail","number":"123-23-4231","amount":"234.44","name":"john ","id":"123","by_phone":true, "status": "under review"}
the .push()
method of js array.
but application object (not array). here can use:
// instead of // $scope.application.push({ 'status': text }); // utilize $scope.application.status = text;
javascript angularjs angularjs-scope
Comments
Post a Comment