所以我聊天应用程序,与此JSON:如何取最后一个值从JSON一个属性在angularjs
{
"561c": [{
"from": "561c",
"fromname": "ryan",
"to": "sasa",
"messgae": "hey"
}, {
"from": "5512",
"fromname": "sasa",
"to": "ryan",
"messgae": "hey too"
}]
}
但这JSON总是加起来当用户发送的消息。我想从“消息”取最后的值,以便在我的文本到语音代码中使用此值,我该如何编写代码?
,这是我的文本到语音转换:
$scope.speakText = function() {
TTS.speak({
text: ***this place is for the code***,
locale: 'en-GB',
rate: 0.75
}, function() {
// handle the succes case
}, function (reason) {
// Handle the error case
});
};
我很抱歉,我编辑我的问题,不所有的值,但只是最后一个,但是当用户再次发送消息时,这个数组总是加起来。 –