Answer the question
In order to leave comments, you need to log in
Why doesn't Angular JS/Javascript add an object to the array?
If you display the current object $scope.messages
in the console:
Object {1: Object, 2: Object, 3: Object, 4: Object}
1: Object { dialog: "534_544"from: "534"message: "Test mEssage"read: "0"time: "1428852706"to: "544" }
var i = {
dialog: "534_544",
from: "538",
message: "Test dmEssage",
read: "0",
time: "528852706",
to: "546"
};
$scope.messages.push(i);
$scope.messages[500] = {
dialog: "534_544",
from: "538",
message: "sex sex",
read: "0",
time: "528852706",
to: "546"
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question