使用ngResource时的空视图

fal*_*off 5 angularjs

我创建这样的工厂:

angular.module('todoApp', ['ngResource']).factory('taskService', ['constantsService', function($resource, constantsService){
var serverUrl = constantsService.server_url;
return {
    add: function(task){ $resource(serverUrl + '/api/task/', {task: task}, {'query':  {method:'POST'}});}
}
}]);
Run Code Online (Sandbox Code Playgroud)

当我将ngResource添加到我的模块时,我得到一个空白的html元素而不是我的应用程序.

fal*_*off 0

我在创建模块时将 ngResource 添加到模块中,而不是在工厂中,并且它可以工作。