在 angular js 中对对象文字使用 ng-repeat 时出错

Error with using ng-repeat over object literal in angular js

我是angular js的新手,现在正在练习过滤器。我完全能够遍历对象数组,但是当我使用对象的对象时,我的浏览器会抛出错误: "Uncaught SyntaxError: Unexpected token"

<!DOCTYPE>
<html>
    <head>
    </head>
    <body>
        <div ng-app="myApp">
            <div ng-controller="myCont">

                <div ng-repeat="b in ar2">
                    {{b}}
                </div>

                {{a}}
                </br></br>
                {{c | myFilt}}
                </br>
                </br>
                <div ng-repeat="(key,value) in d">
                    {{key.a|myFilt}}
                </div>
            </div>
        </div>
        <script src="jquery-3.0.0.js"></script>
        <script src="angular.js"></script>
        <script src="angular_try.js"></script>

    </body>
</html>

这是 angular js :

var myApp = angular.module("myApp",[])

myApp.controller("myCont",["$scope","$filter",function($scope,$filter){
$scope.a ="pro";
$scope.arr = ["abc","bcd","cdb"];
$scope.arr3 = [100,200,300];
$scope.ar2=[];
$scope.c = 10;
$scope.d = {{a:"mishtu",b:500,c:"mondal"},{a:"tulu",b:400,c:"mondal"},
{a:"titlu",b:600,"c":"mondal"}}
}])

一个对象总是在(键,值)对中包含值,但是你的对象

$scope.d = {{a:"mishtu",b:500,c:"mondal"},{a:"tulu",b:400,c:"mondal"},
{a:"titlu",b:600,"c":"mondal"}}

保存着一个对象列表,因此您应该将其声明为一个数组。 像这样

$scope.d = [{a:"mishtu",b:500,c:"mondal"},{a:"tulu",b:400,c:"mondal"},
{a:"titlu",b:600,"c":"mondal"}]

应该这样使用:

var app = angular.module('myApp', []);
app.controller('MyController', ['$scope', function($scope) {
  $scope.title = 'Hello world';

  $scope.d = [{
    a: "mishtu",
    b: 500,
    c: "mondal"
  }, {
    a: "tulu",
    b: 400,
    c: "mondal"
  }, {
    a: "titlu",
    b: 600,
    "c": "mondal"
  }];

}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<div ng-controller='MyController' ng-app="myApp">
  <div>{{title}}</div>

  <table border="1" ng-repeat="myObj in d">
    <tr ng-repeat="(x, y) in myObj">
      <td>{{x}}</td>
      <td>{{y}}</td>
    </tr>
  </table>
</div>