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 answers

i'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

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -