我想创建一个服务来连接到 prestashop API 并使用它。prestashop API 是这样的:
http://APIKEY@domain/api/module
如何使用 ngResource 来支持路径中的 APIKEY 参数并允许跨域连接另一个域?
我不起作用的示例代码是:
.factory('Presta_Products', function ($resource) {
var data = $resource('http://1111111111111111111@localhost/shinatech/OnlineStore/prestashop/api/products/:id', {id: '@id'}, {
update:{
method:'PUT'
}
});
return data;
})
它给出了错误: