Znowman Znowman - 1 year ago 126
AngularJS Question

AngularJS API call

Trying to make an API call.

var app = angular.module("testApp", []);
app.controller("mCtrl", ["$scope", "$http", function($scope, $http) {
.success(function(data) {
$scope.data = data;


Keep getting a 404 response. I can access the data when using the address in the browser though.

Answer Source

First, you should be using $http.get('...') instead of $http.jsonp('...')

And second you forgot to add 'http://...' to the route

The correct way is

  .then(function(data) {
    $scope.data = data;

I've tested it, it should work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download