我想創建一個內部有3個屬性的對象。但是,每次運行代碼時,它都只會顯示代碼表達式。數組和對象如何相互影響?角JS對象vs數組
我的代碼:
var app = angular.module("FundAllocation", []);
app.controller("myCtrl", function($scope) {
\t $scope.AllocFunds = [{Name:'Groceries',AllFunds:'2'},
\t \t \t \t \t \t \t {Name:'Travel',AllFunds:'2'},
\t \t \t \t \t \t \t {Name:'House',AllFunds:'2'}
\t \t \t \t \t \t \t ];
}); \t
<div ng-app="app" ng-controller="myCtrl">
<div ng-repeat="row in AllocFunds">
row: {{row.Name}
</div>
</div>`
您在'row.name'後面缺少最後一個大括號;在你真實的代碼中是否有錯字? –