i need to access a file using $http service. But iam getting below error in Browser console.
SyntaxError: Unexpected token '
at Object.parse (native)
at vc (http://localhost/libFile/angular.min.js:15:313)
at $b (http://localhost/libFile/angular.min.js:81:301)
at http://localhost/libFile/angular.min.js:82:216
at n (http://localhost/libFile/angular.min.js:7:322)
at ed (http://localhost/libFile/angular.min.js:82:198)
at c (http://localhost/libFile/angular.min.js:83:382)
at http://localhost/libFile/angular.min.js:119:302
at m.$get.m.$eval (http://localhost/libFile/angular.min.js:134:83)
at m.$get.m.$digest (http://localhost/libFile/angular.min.js:131:106)
Below is html template with Angular expressions. There is no error here
<html ng-app="nameApp">
<head>
<meta charset="utf-8">
<script src="http://localhost/libFile/angular.min.js">
</script>
<script>
var nameApp = angular.module('nameApp',[]);
nameApp.controller('myController' , function($scope,$http)
{
$http.get('http://localhost/checkangular/art_1.json').success(function(data){
$scope.arts = data;
});
});
</script>
</head>
<body ng-controller="myController">
<ul>
<li ng-repeat="art in arts">
{{art.movie}} - {{art.mainChar}}
</li>
</ul>
</body>
</html>
My art_1.json file.
[
{'movie' : 'i am legand','mainChar':'Will Smith'},
{'movie' : 'Batman Begins','mainChar' : 'Christian Bale'},
{'movie' : 'Man of Steel', 'mainChar' : 'Henry Cavill'}
];
i browsed for finding solution and figured that i might have missed parameters in $http service or modules i did not import. In online tutorials its like they do the same and it works for them.
i am using AngularJS v1.4.0 library
Kindly suggest me a solution here