0
如果我在index.html中的脚本标记中包含angularjs声明,我可以加载项目的页面。否则,不工作。angularjs django集成
应用/模板/应用/ index.html的
{% load staticfiles %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static "components/bootstrap/dist/css/bootstrap.css" %}">
<script type="text/javascript" src="{% static "javascript/app.js"%}"></script>
<script type="text/javascript" src="{% static "components/angular/angular.min.js"%}"></script>
<script type="text/javascript" src="{% static "components/angular-route/angular-route.js"%}"></script>
</head>
<body ng-app="store">
<div ng-controller="ItemController">
{% verbatim %}
<div class="panel" ng-repeat="item in items">
<p>{{ item.id }}</p>
</div>
{% endverbatim %}
</div>
</body>
</html>
应用程序/静态/ JavaScript的/ app.js
angular.module('store', ['ngRoute'])
.controller('ItemController', function($scope, $http) {
$http.get('/api/items').success(function(data){
$scope.items = data;
});
});
欢迎来到Stack Overflow!请查看我们的[SO问题清单](http://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist)来帮助你提出一个好问题,然后得到一个很好的答案。 –
“不工作”如何? –