rag*_*ubs 4 angularjs restangular
我想要完成的目标是在restAngular中做一个帖子.我一直在尝试下面的代码,但是我收到了一个带有customPost的状态代码400.这是我发送请求的URL ... http://localhost/api/api/index.php/auth/token/ [object%20Object].正如您所看到的,[object%20Object]正在添加gettting.我怎么摆脱这个?我应该在customPOST之外做另一种方法吗?为什么要添加这个?
var login = Restangular.one('auth/token').customPOST(
{grant_type:"password", username:"b@t.com",password:"666666",scope:"app"},{},{},
{Authorization:'Basic ' + client,
ContentType:'application/x-www-form-urlencoded'});
Run Code Online (Sandbox Code Playgroud)
customPOST的第二个参数应该是表示路径的字符串.试试这个:
var login = Restangular.one('auth/token').customPOST(
{grant_type:'password', username:'b@t.com', password:'666666', scope:'app'},
'',
{},
{
Authorization:'Basic ' + client,
ContentType:'application/x-www-form-urlencoded'
}
);
Run Code Online (Sandbox Code Playgroud)
或这个:
var login = Restangular.one('auth').customPOST(
{grant_type:'password', username:'b@t.com', password:'666666', scope:'app'},
'token',
{},
{
Authorization:'Basic ' + client,
ContentType:'application/x-www-form-urlencoded'
}
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11854 次 |
| 最近记录: |