Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 安格拉斯<;ng repeat>;用于加载json_Javascript_Angularjs_Json - Fatal编程技术网

Javascript 安格拉斯<;ng repeat>;用于加载json

Javascript 安格拉斯<;ng repeat>;用于加载json,javascript,angularjs,json,Javascript,Angularjs,Json,我试图在我的示例SPA应用程序中加载json文件,但出于某种动机,我不明白为什么当我尝试运行我的应用程序时,控制器没有填满浏览器的选项卡……我是一个初学者,这是我第二天尝试解决这个问题,但我认为我的解决方案失败了。 这是我的代码: <html ng-app="beerApp"> <head> <meta charset="utf-8"> <title>Angular.js Example</title> &l

我试图在我的示例SPA应用程序中加载json文件,但出于某种动机,我不明白为什么当我尝试运行我的应用程序时,控制器没有填满浏览器的选项卡……我是一个初学者,这是我第二天尝试解决这个问题,但我认为我的解决方案失败了。 这是我的代码:

<html ng-app="beerApp">
  <head>
    <meta charset="utf-8">
    <title>Angular.js Example</title>
    <script src="js/libs/angular.js/angular.js" type="text/javascript"></script>
    <script src="beerApp.js" type="text/javascript"></script>
  </head>
  <body ng-controller="beerCtrl">
    Search:<input ng-model="query" type="text"/>
    <table>
      <tr>
        <th><a>Name</a></th>
        <th>Description</th>
        <th><a href="" ng-click="sortField = 'abv'">Abv</a></th>
        <th><a href="" ng-click="sortField = 'name'">Ibu</a></th>

      </tr>
      <tr ng-repeat="beer in beers | filter:query | orderBy:sortField">
        <td>{{beer.name}}</td>
        <td>{{beer.descript}}</td>
        <td>{{beer.abv}}</td>
        <td>{{beer.ibu}}</td>
      </tr>
    </table>
  </body>
</html>

Angular.js示例
搜索:
{{beer.name}
{{beer.descript}}
{{beer.abv}}
{{beer.ibu}}

提前谢谢 阿尔博
ps.完整版本在plnkr上

您需要在plnkr中有一个
index.html
选项卡。看到结果了吗


它正在按您的期望工作

我不知道!荣誉