出于某种原因,我收到了这个错误:
未捕获的ReferenceError:$ stateProvider未定义
即使angular-ui-router.js
被正确加载。
这是我的代码
(function () {
var mod = angular.module('MyApp', ['ui.router']);
debugger;
mod.config(['$stateProvider', '$locationProvider', function ($stateProvider, $locationProvider) {
$stateProvider.state('product', {
url: "/home/product",
views: {
"view1": {
templateUrl: "/Angular/Components/Products/Products.html",
controller: "Ctr_Products",
}
}
});
$locationProvider.html5Mode({
enabled: true, requireBase: false
});
}]);
答案 0 :(得分:0)
这是我的根源
upload
答案 1 :(得分:0)
(function () {
var mod = angular.module('MyApp', ['ui.router']);
debugger;
mod.config(function ($stateProvider, $locationProvider) {
$routeProvider.when("/product", {
controller: "Ctr_Products",
templateUrl: "/Angular/Components/Products/Products.html"
});
$routeProvider.otherwise({ redirectTo: "/Home" });
$locationProvider.html5Mode({
enabled: true, requireBase: false
});
}]);