Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCatalin Voineag
7,823 PointsAngular JS JSONP request on localhost
Hi, my name is Catalin and I want to build an Angular app that renders data from a localhost node.js server. But I can't get it to communicate properly with the server, and the page remains empty. Here is my code:
Index page:
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="angular.min.js"></script>
<script src="controller.js"></script>
</head>
<body >
<div ng-controller="MainController">
<h1>App</h1>
<h1>{{people.age}}</h1>
</div>
</body>
</html>
controller :
var app = angular.module('myApp', []);
app.controller('MainController', ['$scope', '$http', function($scope, $http){
$http.jsonp('http://localhost:8080/person/?callback=JSON_CALLBACK').success(function(data){
$scope.people = data;
});
}]);
Any ideas?
1 Answer
Unsubscribed User
501 PointsYou should provide the content of your console, right after the request happened. Without that console error / warning, nobody will answer this question.