我有以下代码:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script type="text/javascript">
var application = angular.module('Application');
application.controller('ImageController', function ImageController($scope, $http) {
$scope.result = "Start here ...";
$http.get('api/images').
success(function (data, status, headers, config) {
$scope.images = data;
$scope.result = "Everything is ok";
}).
error(function (data, status, headers, config) {
$scope.result = "Something went wrong";
});
});
</script>
<div ng-app="Application" ng-controller="ImageControler">
<p>{{result}}</p>
<div ng-repeat='image in images'>
<span>{{image.votes}}</span>
</div>
</div>
我在呈现的HTML网页上获得的是{{result}}和{{image.votes}},例如Angular无效...我还检查了API并且没有调用它...
我错过了什么?
答案 0 :(得分:5)
<div ng-app="Application" ng-controller="ImageControler">
2 L&#39的控制器