After spending a lengthy hour trying to troubleshoot this issue, I am at a loss as to why it is not functioning correctly.
I have been attempting to showcase a row of images on a webpage using Angular based on data fetched from a json file. Unfortunately, Angular continues to present me with the following error:
SyntaxError: Unexpected token }
at Object.parse (native)
at fromJson (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:1076:14)
at defaultHttpResponseTransform (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:8651:16)
at http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:8736:12
at forEach (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:327:20)
at transformData (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:8735:3)
at transformResponse (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:9465:23)
at processQueue (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:13293:27)
at http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:13309:27
at Scope.$get.Scope.$eval (http://localhost:3000/assets/angular.self-5bf4e8cd0241c34665eca1c336b104c0716c32c68edd291d6ae5b0e0935d29ec.js?body=1:14548:28)
Here's the code snippet:
HTML:
<div id="officersPage" class="row" ng-app="officers" ng-controller="officerCtrl">
<div id="officerModals" class="col-md-4" ng-repeat="officersOne in officersGroup">
<div class="officerPics" ng-repeat="officer in officersOne">
<%= image_tag('logo.png', :id=>"{{officer.id}}", size: '140x140', :class=>"img-responsive, img-thumbnail") %>
</div>
</div>
<div id="moreDetails" class="col-md-4">
</div>
</div>
Angular code:
# Contains the Angular code for the officer page -> will generate all the pictures and modals based on info through JSON file
app = angular.module('officers', [])
app.controller 'officerCtrl', [
'$scope'
'$http'
($scope, $http) ->
$http.get('./officers.json').success (data) ->
console.log(data)
$scope.officersGroup = data
console.log($scope.officersGroup)
return
]
Any assistance would be greatly appreciated!
Edit: Here is a glimpse of the JSON file content:
{
"officers": [
{
"name": "Matt Zhang",
"role": "Webmaster",
"class": "2018",
"id" : "matt"
}
]
}