我在angular 1应用程序中实现了ui-router,并配置了路由状态。当我尝试访问该页面时,我收到了本文标题中提到的错误。请在下面找到我的代码。有人能告诉我哪里出错了。
app.js
(function () {
"use strict";
var app = angular.module("productManagement", ["common.services","ui.router"]);
}());
config.js
(function () {
"use strict";
var app = angular.module("productManagement");
app.config(["stateProvider",
function ($stateProvider) {
$stateProvider
.state("productList", {
url: "/product",
templateUrl: "app/product/productListView.html",
controller: "ProductListController as vm"
});
}]);
}
());
ProductListController
(function () {
"use strict";
angular
.module("productManagement")
.controller("ProductListController", ["productResource", ProductListController]);
function ProductListController (productResource)
{
var vm = this;
productResource.getProducts()
.then(function (response) {
vm.products = response.data;
}, function (error) {
vm.status = 'Unable to load product data: ' + error.message;
});
vm.showImage = false;
vm.toggleImage = function () {
vm.showImage = !vm.showImage;
};
}
}());
答案 0 :(得分:1)
他的配置中需要改变的一件事:
<input>
到
.config(["stateProvider",