以下是我的app.js文件
(function ()
{
'use strict';
var app = angular.module('farmApp',['ngRoute','toastr','firebase','employeeModule']);
app.config(function($routeProvider, $locationProvider)
{
$routeProvider
.when('/',
{
templateUrl : 'App/views/index.ejs'
})
.when('/employees',
{
templateUrl : 'App/views/employees/employees.ejs'
})
.when('/newemployee',
{
templateUrl : 'App/views/employees/newEmployee.ejs'
})
.when('/employees/edit/:id',
{
templateUrl : 'App/views/employees/editEmployee.ejs'
});
$locationProvider.html5Mode({ enabled: true,
requireBase: false});
});
})();
这里是我的第一页,我正在尝试路由到一个编辑页面,其路线已经在我上面的app.js文件中定义。我在网络浏览器中看到了网址的更改。但编辑页面无法呈现。我所有的其他路线工作正常,所以我不确定问题出在哪里。
<div ng-app="employeeModule">
<div ng-controller="employeeCtrl">
<div class="row" ng-init="initList()">
<div class="col-md-12">
<div class="card">
<div class="header">
<h4 class="title">Employees</h4>
<hr>
<a class="btn btn-primary btn-fill" href="/newemployee">New Employee <i class="ti-plus"></i></a>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-striped">
<thead>
<th>Name</th>
<th>Salary</th>
<th>Phone Number</th>
<th>Address</th>
<th>Position</th>
</thead>
<tbody>
<tr ng-repeat="single in employees">
<td>{{single.name}}</td>
<td>{{single.salary}}</td>
<th>{{single.phone}}</th>
<th>{{single.address}}</th>
<th>{{single.position}}</th>
<td><a href="/employees/edit/{{single.$id}}"><i class="ti-pencil"></i></a></td>
<td><i class="ti-trash" ng-click="remove(single)"></i></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>