1
我只是很难找出当我尝试在浏览器上查看它们时为什么没有显示角度表达式。我试图嵌入NG重复到一个无序列表,但是HTML显示为:AngularJS表达式没有被处理
{{country.name}}
{{city.name}}
这是我有:
<!doctype html>
<html>
<head>
<script src="Scripts\angular.js"></script>
<script src="Scripts\script.js"></script>
</head>
<body ng-app="myModule" style="font-family:Arial">
<div ng-controller="myController">
<ul>
<li ng-repeat="country in countries">
{{country.name}}
<ul>
<li ng-repeat="city in country.cities">
{{city.name}}
</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
var myApp = angular
.module("myModule", [])
.controller("myController", function($scope) {
var countries = [
{
name: "UK",
cities: [
{ name: "London" },
{ name: "Manchester" },
{ name: "Portsmouth" }
]
},
{
name: "USA",
cities: [
{ name: "New York" },
{ name: "Trenton" },
{ name: "Philidelphia" }
]
},
{
name: "Poland"
cities: [
{ name: "Warsaw" },
{ name: "Poznan" },
{ name: "Lodz" }
]
}
];
$scope.countries = countries;
});
[打开浏览器的控制台(http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers),并检查是否有任何错误消息。 – JJJ