The angular code is below along with the html. The problem is that the endpoint '/contacts/:id' returns json in Postman and Chrome. Obviously I swap :id with 0037000001pIldUAAS for those tests, but the endpoint seems to be good. When the page is loaded '{}' is all I'm getting in $scope.data. What on earth am I doing wrong here? The example I've provided is almost verbatim what's in the angular documentation for get(). I have validated that the json I'm getting from the backend is valid.
Does anyone see something that looks out of order?
var app = angular.module('app', ['ngResource']);
app.factory('Contact', ['$resource', function($resource) {
return $resource('http://localhost:3000/contacts/:id');
}]);
app.controller('ContactCtrl', ['$scope', 'Contact',
function($scope, Contact) {
$scope.data = Contact.get({id:'0037000001pIldUAAS'});
}]);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="angular.min.js"></script>
<script src="angular-resource.js"></script>
<script src="test.js"></script>
</head>
<div ng-app="app">
<div ng-controller="ContactCtrl">
{{data}}
<h5>Is angular working: {{working}}</h5>
<input ng-model="working"/>
</div>
</div>
</body>
</html>
Here's a snip of the json that's returned by the api:
{
"Id": "0037000001elHP3AAM",
"LastName": "first",
"FirstName": "last"
...
}
**Edit: added Chrome dev tools screenshots: