Can';让ng repeat在angularjs中与控制器中的数组一起工作
下面是我的代码。不知道为什么ng repeat显示为完全空白 非常感谢您的帮助 拉里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/
- {{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>