Below is the snippet from my "app.js" file:
var app = angular.module('WebUI',[]);
app.config(function($httpProvider){
delete $httpProvider.defaults.headers.common['X-Requested-With'];
});
app.config(function($locationProvider){
$locationProvider.html5Mode(true);
});
This is the code block from my controller:
var Controller = function ($scope,$http)
{
$scope.thingsList=[];
$http({method: 'GET', url: 'http://192.168.1.4/search'}).success(function(data)
{
results=data.results;
angular.forEach(results,function(result)
{
$scope.thingsList.push(result.split('/')[1]);
});
}).error(function(data){});
}
And here is a portion of my HTML page:
<!DOCTYPE html>
<head>
<title>All</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>
<script src="controller.js" type="text/javascript"></script>
</head>
<body>
<a href="home.html">HOME</a>
<div id='content' ng-app='WebUI' ng-controller='Controller'>
<li ng-repeat="thing in thingsList">
<a href="home.html">{{thing}}</a>
</li>
</div>
</body>
</html>
I am facing an issue where clicking on one of the generated links throws an error after redirecting from the home button. The error message I receive is:
Error: Failed to execute 'pushState' on 'History': A history state object with URL 'file:///home/abc/home.html' cannot be created in a document with origin 'null'.
If anyone has encountered this problem before or knows how to resolve it, I would appreciate any assistance. Thank you!