Reputation: 215
I am trying to implement AngularJS Routing Using UI-Router. I have index.html file which is trying to load the partial productListView.html using app.js as javascript but i am seeing Error: Unexpected request: GET productListView.html in my console. Any help would be appreciated.
index.html:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Acme Product Management</title>
<!--Style Sheets-->
<link rel="stylesheet" type="text/css" href="styles/app.css">
<link rel="stylesheet" type="text/css" href="styles/bootstrap.css">
</head>
<body ng-app="productManagement">
<div class="container">
<div ui-view></div>
</div>
<!--Library Scripts-->
<script src="js/angular.min.js"></script>
<script src="js/angular-mocks.js"></script>
<script src="js/angular-resource.min.js"></script>
<script src="js/angular-ui-router.min.js"></script>
<!--Application Script-->
<script src="app.js"></script>
<!--Services-->
<script src="common/services/common-services.js"></script>
<script src="common/services/productResource.js"></script>
<script src="common/services/productResourceMock.js"></script>
<!--Product Controllers-->
<script src="products/productListCtrl.js"></script>
</body>
</html>
app.js:
(function(){
'use strict';
angular.module('productManagement',['common-services',
'productResourceMock',
'ui.router'])
.config(['$stateProvider',
'$urlRouterProvider',
function($stateProvider,
$urlRouterProvider){
$urlRouterProvider.otherwise('/products');
$stateProvider
.state('productList', {
url: '/products',
templateUrl: 'products/productListView.html',
controller: 'ProductListCtrl'
});
}]
);
})();
Upvotes: 2
Views: 724
Reputation: 96
I think, you must change: $httpBackend.whenGET(/app/).passThrough();
in productResourceMock.js
file
Upvotes: 8
Reputation: 18193
You are incorrectly icluding Javascript files that are meant for testing in your HTML file. The error you are seeing comes from the "mock" version of HTTPBackend that is used in unit tests.
You should remove lines like these from the HTML:
<script src="js/angular-mocks.js"></script>
<script src="common/services/productResourceMock.js"></script>
Upvotes: 0