简体   繁体   中英

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. Passed factory name to Controller.

Its giving error

"Error: [$injector:unpr] "

can you provide more details around your query, i see you have mentioned $resource.

$resource is a factory which creates a resource object that lets you interact with RESTful server-side data sources.

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 
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM