我用jbuilder创建了一个.json,并在我的service.js中创建了工厂:
.factory "ArticlesEntries",
["$resource", ($resource) -> $resource "/news_articles/:id", {},
index: method: "GET", isArray:true , params: action: "index"
show: method: "GET", params: action: "show"
]
我的控制器是:
angular.module('miApp').controller 'ArticlesEntriesCtrl', [
"$scope","$location", "ArticlesEntries"
($scope, $location, ArticlesEntries) ->
$scope.articles_entries = ArticlesEntries.query()
console.log(ArticlesEntries.query())
]
但是当在view {{articles_entries.title}}和console.log中没有发生refresh / news_articles时,返回一个空数组。
有什么问题?
谢谢!
答案 0 :(得分:0)
如果http请求完成,您是否登记了Chrome开发者工具?在“网络”选项卡中查看它,您可以显示响应以确定它是否为空数组。