私たちのビューでng-repeatを使うように、どのようにしてアレイのループからデータを取得できますか?anglejsのコントローラでアレイループを得るにはどうすればいいですか
私はこれ欲しい:
function test() {
var data = [];
for(var i = 0; i < 10; i++) {
var newtest = {
text: 'text',
class: 'class_name',
user_chat_img: "images/noimage.jpg",
time_stamp: 'myJSON2'
}
// console.log('chat history',myJSON);
data.push(newtest);
}
return data;
}
var $scope.message = test();
console.log('message', $scope.message);
は、今私はどのようにすることができ、この配列の値は、テキスト、クラスなど
、すなわち取得し、これが私にこの
Array[1]
0: Object
class: "class_name"
text: "text",
time_stamp: "myJSON2",
user_chat_img: "images/noimage.jpg"
__proto__: Objectlength: 1__proto__: Array[0]
のようなコンソールでデータを提供したいと私のコントローラでこれらの値を取得する ng-repeatを使用して私のビューでこれらの値を取得します
のng-repeat={x in message}
and then
x.class
おかげ
私は –