Ruby on rails ActionController::HomeController#索引中的未知信息
我在rails应用程序中使用angularjs。 在我的js文件中,我有这样的代码Ruby on rails ActionController::HomeController#索引中的未知信息,ruby-on-rails,angularjs,Ruby On Rails,Angularjs,我在rails应用程序中使用angularjs。 在我的js文件中,我有这样的代码 var myApp = angular.module('myApp',[]); myApp.controller('locationController',function($scope,$http){ $scope.user = {}; $http.get('./locations.json').success((data) $scope.locations = data )})
var myApp = angular.module('myApp',[]);
myApp.controller('locationController',function($scope,$http){
$scope.user = {};
$http.get('./locations.json').success((data)
$scope.locations = data
)})
在我的控制器动作中
回复:json
def index
@locations = Location.all
respond_with(@locations)
end
我刚刚纠正了一些语法错误,请让我知道一旦你检查这些下面的更正
var myApp = angular.module('myApp',[]);
myApp.controller('locationController',function($scope,$http){
$scope.user = {};
$http.get('./locations.json').success(function(data) {
if(data)
$scope.locations = data;
});
});
在my routes.rb resources:locations中,:defaults=>{:format=>“json”}感谢您的回复,我已经更正了语法错误,但是找不到它的showig locations.json您可以检查locations.json的相对路径吗?