下面是我的 Angular 项目的 ui 路由设置。我无法调出工单列表页面。我不确定以下设置有什么问题,请您告诉我如何打开工作订单列表页面来查看我的工作订单。
在浏览器上调用的 URL http://localhost:63342/vdash/index.html#/workorders
应用程序.js
(function () {
"use strict";
var app = angular.module("workOrderManagement", ["common.services", "ui.router", "workOrderResourceMock"]);
app.config(["$stateProvider", "$urlRouterProvider", function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/workorders");
$stateProvider.state("workOrderList", {
url: "/workorders",
templateUrl: "app/workorder/workOrderListView.html",
controller: "workOrderCtrl as vm"
})
}]
)
})();
workOrderResourceMock.js
(function () {
"use strict";
var app = angular.module("workOrderResourceMock", ["ngMockE2E"]);
app.run(function ($httpBackend) {
var workOrders = [
{
"orderNo": "WO-0000001",
"city": "San Jose",
"bank": "Citi Bank",
"branch": "Maxrk",
"creationDate": "2017-10-01",
"clientName": "Mr.Peter",
"status": "PENDING",
"handledBy": "Peter",
}
];
var workOrderUrl = "/workorders";
$httpBackend.whenGET(workOrderUrl).respond(function(method, url, data){
// just to see if it his this function will remove later
alert("into the backend method");
console.log(url);
return [200, workOrders];
});
$httpBackend.whenGET("/").passThrough();
});
}());
错误
angular.js:13236 错误:意外请求:GET
app/workorder/workOrderListView.html 在 $httpBackend (angular-mocks.js:1403) 处不再有请求