Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.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
Can';让ng repeat在angularjs中与控制器中的数组一起工作_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

Can';让ng repeat在angularjs中与控制器中的数组一起工作

Can';让ng repeat在angularjs中与控制器中的数组一起工作,angularjs,angularjs-ng-repeat,Angularjs,Angularjs Ng Repeat,下面是我的代码。不知道为什么ng repeat显示为完全空白 非常感谢您的帮助 拉里 {{x} var-app=angular.module('myApp',[]); 应用程序控制器('myCtrl',函数($scope){ $scope.names=[“Emil”、“Tobias”、“Linus”]; }); 修复打字错误 <!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/

下面是我的代码。不知道为什么ng repeat显示为完全空白

非常感谢您的帮助

拉里


  • {{x}
var-app=angular.module('myApp',[]); 应用程序控制器('myCtrl',函数($scope){ $scope.names=[“Emil”、“Tobias”、“Linus”]; });
修复打字错误

  <!DOCTYPE html>
  <html>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"> </script>
  <body>
  <div ng-app="myApp" ng-controller="myCtrl">
      <ul><li ng-repeat="x in names">{{x}}</li></ul> </div>
<script>
   var app = angular.module('myApp', []);
   app.controller('myCtrl', function($scope) {
   $scope.names = ["Emil","Tobias","Linus"];
    });
</script>

</body>
</html>

  • {{x}
var-app=angular.module('myApp',[]); 应用程序控制器('myCtrl',函数($scope){ $scope.names=[“Emil”、“Tobias”、“Linus”]; });
我想应该是:
ng repeat
ngrepeat是个打字错误。当拼写错误被修复时,实际代码可以正常工作。发布一个完整的例子,再现错误。@Lary G.你能接受答案吗。所以问题就结束了
  <!DOCTYPE html>
  <html>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"> </script>
  <body>
  <div ng-app="myApp" ng-controller="myCtrl">
      <ul><li ng-repeat="x in names">{{x}}</li></ul> </div>
<script>
   var app = angular.module('myApp', []);
   app.controller('myCtrl', function($scope) {
   $scope.names = ["Emil","Tobias","Linus"];
    });
</script>

</body>
</html>