这是我的retails.htm:
<p><a href="#/">Main</a></p>
<a href="#categories">categories</a>
<a href="#departments">departments</a>
<a href="#digital_marketing">digital_marketing</a>
<div class="ng-view"></div>
<script>
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "main.htm"
})
.when("/categories/", {
templateUrl : "categories.htm"
})
.when("/departments/", {
templateUrl : "departments.htm"
})
.when("/digital_marketing/", {
templateUrl : "digital_marketing.htm"
});
});
categories.htm:
<div ng-app="myApp2" ng-controller="customersCtrl3">
<table border="1">
<b><tn>categories</tn></b>
<tr>
<th>dept_id</th>
<th>category_name</th>
<th>category_discription</th>
<th>current time</th>
<th>Id</th>
</tr>
<tr ng-repeat="x in categories">
<td>{{ x.dept_id }}</td>
<td>{{ x.category_name }}</td>
<td>{{ x.category_discription }}</td>
<td>{{ x.currenttime }}</td>
<td>{{ x.id }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp2', []);
app.controller('customersCtrl3', function($scope, $http) {
$http.get("http://localhost:8081/listtables").then(function (response) {
$scope.categories = response.data.categories;
});
});
</script>
</body>
</html>
当我运行retails.htm并点击类别时,它没有任何数据。只显示空白表。 这里只有一个代码,即cateogries.htm。我希望与部门和digital_marketing一样。
http://localhost:8081/listtables是在localhost上运行的节点js文件。