[英]ngResource is not working in my project, imported cdn for angularjs version 1.3.14, angular-resource 1.3.14
Injected 'ngResouce', Created factory and used $resource in that. 注入了“ ngResouce”,创建了工厂并在其中使用了$ resource。 Passed factory name to Controller.
将工厂名称传递给控制器。
Its giving error 给予错误
"Error: [$injector:unpr] " “错误:[$ injector:unpr]”
can you provide more details around your query, i see you have mentioned $resource. 您能否提供有关查询的更多详细信息,我看到您提到了$ resource。
$resource is a factory which creates a resource object that lets you interact with RESTful server-side data sources. $ resource是一个工厂,它创建一个资源对象,使您可以与RESTful服务器端数据源进行交互。
from your question its not clear how you are injecting the resource, if you are defining a module you may try this 从您的问题还不清楚您是如何注入资源的,如果要定义模块,可以尝试一下
angular.module('app', ['ngResource']);
and for creating a factory you may try the below code, 对于创建工厂,您可以尝试以下代码,
angular.module('app', ['ngResource'])
.factory('myfactory', function($resource){
// your code here
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.