Reputation: 87
For some reason I'm getting this error:
Uncaught ReferenceError: $stateProvider is not defined
even though angular-ui-router.js
is being loaded fine.
Here is my code
(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
});
}]);
Upvotes: 1
Views: 382
Reputation: 98
(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
});
}]);
Upvotes: 1
Reputation: 87
here is my roots
<base href="/">
<script src="~/Scripts/jquery-3.3.1.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<link href="~/Scripts/jquery-ui.css" rel="stylesheet" />
<script src="/Scripts/angular.js"></script>
<script src="/Scripts/angular-route.js"></script>
<script src="/Scripts/angular-ui-router.js"></script>
<script src="/Angular/Modules/MyApp.js"></script>
<script src="/Angular/Components/Products/Ctr_Products.js"></script>
<script src="/Angular/Factories/ProductFactory.js"></script>
<link href="/Content/bootstrap.css" rel="stylesheet" />
Upvotes: 1