[英]How do I make a Restangular POST?
I have the following in my Angular Model: 我的Angular模型中具有以下内容:
return Restangular.all('user/session/authenticate').post({user_id: user_id, password: password});
Which I call in my controller: 我在控制器中称其为:
User.authenticate($scope.user.userId, $scope.user.username)
.then(function (authToken) {
//do stuff
};
But, it never makes a request. 但是,它从未发出请求。 The headers are created, the data is there, and there is no error.
标头已创建,数据已存在,并且没有错误。 I know it's probably me, but for the life of me, I can't figure out what.
我知道可能是我,但对于我的一生,我不知道该怎么办。 Also, I can successfully make GET requests to the same service.
另外,我可以成功向同一服务发出GET请求。
Well, the problem wasn't me...sort of. 好吧,问题不是我。 I had the correct Restangular syntax, but a lack of understanding of how my browser works.
我使用正确的Restangular语法,但是对我的浏览器的工作原理缺乏了解。 The browser wanted me to confirm a security exception.
浏览器要我确认安全例外。 No error was given, until I put the url directly into the url bar in FireFox.
没有错误,直到我将网址直接放入FireFox的网址栏中。
Once I confirmed the security exception, the requests began to work. 一旦我确认了安全异常,请求就开始起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.