我尝试创建聊天应用程序必须私下将消息从user-1推送到user-2。我创建了$scope.msgs=[];
变量来存储消息。这段代码不是我的代码,我从here获取了源代码。
这里是发送消息的发送消息功能。
$scope.msgs.push({
msg:$scope.send_text,
from_id:$scope.uid,
to_id:$scope.send_to_userinfo.id,
timestamp:Math.floor(new Date() / 1000)
});
$scope.send_text="";
$scope.self.scrollDiv();
console.log($scope.msgs);
}
答案 0 :(得分:0)
而不是这一个---> $scope.msgs=[];
,请尝试var msgs=[];
。希望它能起作用。