简体   繁体   English

ngResource在我的项目中不起作用,为angularjs版本1.3.14,angular-resource 1.3.14导入了cdn

[英]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.

相关问题 .ng-enter无法在Angular 1.3.14中使用? - .ng-enter not working in Angular 1.3.14? 当我使用AngularJS 1.3.14时不读取JSON文件,但在1.2.10版中可以正常工作 - Not reading JSON file when I use AngularJS 1.3.14 but works fine with version 1.2.10 我们应该在angular js版本1.3.14中使用$ locationProvider吗 - shall we use $locationProvider in angular js ver 1.3.14 检测是否为CDN回退加载了Angular依赖项[angular-route,angular-resource等] - Detect if Angular dependencies [angular-route, angular-resource, etc] are loaded for CDN fallback ng-route injectore中的错误:modulerr [$ injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr - Error in ng-route injectore:modulerr [$injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr 角资源未正确注入AMD - angular-resource not being properly injected with AMD Angular ngResource仍然无法识别$ resource - Angular ngResource still not recognising $resource Angularjs Restful使用ngResource不起作用 - Angularjs Restful using ngResource not working 借助angular-resource将值插入db.json - Insert value into db.json with help of angular-resource 角度水疗应用程序无法正常工作ngResource - angular spa app not working ngResource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM