Utilizing Angularjs to fetch JSON data from a Rails test app deployed on Heroku is proving to be a bit challenging. Below you can find the snippets of my Angular and Rails code.
An error message displayed in my Firebug console reads: "NetworkError: 404 Not Found - "
Any insights on why this setup isn't functioning correctly?
Angularjs code
var App = angular.module('App', []);
App.controller('TodoCtrl', function($scope, $http) {
$http.get('http://desolate-earth-2852.herokuapp.com/declarations.json')
.then(function(res){
$scope.todos = res.data;
});
});
Rails code
def index
@declarations = Declaration.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @declarations }
end
end
Route Configuration
Test::Application.routes.draw do
root :to => 'welcome#index'
get "welcome/index"
resources :declarations
end