我想在屏幕上只显示value
字符串,但它当前是键值和值对"id":0 , "value":"lorem ipsum
。如何使用以下方法显示lorem ipsum
?
main.html中
<li ng-repeat="message in event | limitTo:1000" ng-class="{lastItem: $last}"><span><strong>Log:</strong></span><span>{{message}}</span></li>
数据
Log:{"id":0,"value":"Lorem test Ipsum is simply dummy text text of"}
ctrl.js
safelyAdd({
id:$scope.event.length,
value: data
});
function safelyAdd(element){
if(totalRecieved > Bufferlimit){
$scope.event =[];
totalRecieved = 0;
}
$scope.event.push(element); //then push new item..
console.log('array',$scope.event);
}
答案 0 :(得分:2)
使用.
运算符并显示消息message.value
<li ng-repeat="message in event | limitTo:1000" ng-class="{lastItem: $last}"><span><strong>Log:</strong></span><span>{{message.value}}</span></li>
答案 1 :(得分:0)
您刚刚使用了message.value,未使用完整对象消息