動態創建一個數組我有一個JSON如下角JS:如何通過讀取JSON陣列
[
{
"id": 1000,
"name": "Open"
},
{
"id": 1000,
"name": "Ravi"
},
{
"id": 1000,
"name": "POOO"
}]
On click of a button I am trying to create a Array by reading all the names from the Array
I have tried as follwoing
var myapp = angular.module('myapp', []);
myapp.controller('FirstCtrl', function($scope)
{
$scope.formData = function()
{
var aa = $scope.tickets.length;
$scope.products = $scope.tickets.name;
alert($scope.products);
};
$scope.tickets = [
{
"id": 1000,
"name": "Open"
},
{
"id": 1000,
"name": "Ravi"
},
{
"id": 1000,
"name": "POOO"
}]
});
目前我得到不確定,可以請你讓我知道該怎麼做這個
謝謝提前
http://jsfiddle.net/9fR23/434/
我不使用for循環讀取要臣民風格。
請問您能否提出一個專業的方法。
已經提到的不是會不會循環播放 –