1
How do I add 1 item to a json object in Angularjs.
In case I have: {COD: 29, MOTIVO: "teste"}
And I’d like you to stay: {COD: 29, MOTIVO: "teste", ID : 12345789}
I tried it this way:
$scope.cadastroSolicitacao = function(values){
$scope.v = values;
$scope.v.push({MATRICULA : '123456789'})
//console.log($scope.v);
};
In the above case, when I clicked the button containing the form it would run the function cadastroSolicitacao
take the values of it and add this item MATRICULA
, but I was unsuccessful.
"There’s no way to do this at the angle, that’s javascript". What? Angular is Javascript.
– Jéf Bueno
@jbueno just what I wanted to explain. To answer the first line of the question: "How do I add 1 item in a json object in Angularjs."
– Giovane