Restangular,是否可以在没有先前阅读的情况下发帖?

时间:2015-10-28 17:29:17

标签: restangular

在文档的示例中,每个POST前面都有一个读数,是否可以在没有上一步的情况下执行Post?

再见 埃尔韦

1 个答案:

答案 0 :(得分:0)

Restangular需要知道您要发布的资源,这是必需的步骤,否则它将无法生成网址。

要获取数据,您只需要不使用get()getList()方法。

所以这些都应该有效:

var account = Restangular.service("accounts");
account.post({data});

var account Restangular.oneUrl('googlers', 'http://www.google.com/1');
account.post({data});

// the 'one()' method will allow you to use 'account.save()' later which will decide to POST or PUT accordingly
var account = Restangular.one("accounts");
account.post({data});
相关问题