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