Javascript 为什么ng repeat在AngularJs 1.5.x组件中不起作用

Javascript 为什么ng repeat在AngularJs 1.5.x组件中不起作用,javascript,angularjs,Javascript,Angularjs,以下是index.html: <!DOCTYPE html> <html ng-app="helloall"> <head> <meta charset="utf-8" /> <title>Hello All</title> <script>document.write('<base href="' + document.location + '" />');</s

以下是index.html:

<!DOCTYPE html>
<html ng-app="helloall">

  <head>
    <meta charset="utf-8" />
    <title>Hello All</title>
    <script>document.write('<base href="' + document.location + '" />');</script>
    <link rel="stylesheet" href="style.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular.min.js"></script>
    <script src="app.js"></script>
  </head>

  <body ng-controller="MainCtrl">
    <item data="name" ng-repeat="name in names"></item>
  </body>

</html>
下面是item.html:

<tr ng-repeat="name in $ctrl.otherNames">
  Name: {{name.last}}
</tr>
<br>
{{$ctrl.data.first}}
{{$ctrl.data.family}}
<br>

名称:{{Name.last}

{{$ctrl.data.first} {{$ctrl.data.family}
以下是输出:

其他姓氏:
测试asdf

其他姓氏:

测试2 qwerty

我想知道为什么在下一节中重复ng不起作用:

<tr ng-repeat="name in $ctrl.otherNames">
      Name: {{name.last}}
</tr> 

名称:{{Name.last}
{{name}}或{{name.last}}不输出任何内容

当我执行{{$ctrl.otherNames}}时,输出显示“otherNames”的内容

为什么?


在Plunkr中查看问题:

item.html
中的
tr
标记更改为
div
将使其正常工作

此外,您只需在
tr
周围添加
table
标记,然后再在
td
周围添加
标记即可


它可以工作。所以问题是html,而不是组件中的angularjs ng repeat。为什么在纯html中,我可以这样做并显示数据?然而,当与Angularjs一起使用时,它需要有table标记才能工作?
<tr ng-repeat="name in $ctrl.otherNames">
      Name: {{name.last}}
</tr>