I am trting to read a json file through Angular's built-in services called $http.But, the page gives me an error saying "Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load respective json file".
Here's my code:
angularExample.html
<!DOCTYPE html>
<html ng-app="Fino">
<head>
<link rel="stylesheet" type="text/css" href="scripts/bootstrap.min.css" />
<script type="text/javascript" src="scripts/angular.min.js"></script>
<script type="text/javascript" src="scripts/app.js"></script>
</head>
<body ng-controller="FinController as fin">
<ul ng-repeat="emp in fin.employees" >
<li>Name:{{emp.name}}</li>
<li>Age:{{emp.age}}</li>
</ul>
</body>
</html>
app.js
var app=angular.module("Fino",[]);
app.controller('FinController',['$http',function($http){
var store=this;
$http.get('emp.json').success(function(data){
store.employees=data;
});
}]);
emp.json
[
{name:'abc',age:27},
{name:'bcd',age:24},
{name:'efg',age:22}
];
Error Snapshot:
