问题描述
我使用Angularjs $资源和放大器; $ http和使用API,但是由于安全原因,我需要调用(HTTPS协议下工作)HTTPS请求。
I am using Angularjs $resource & $http and working with apis, however due to security reason I need to call HTTPS request(work under the HTTPS protocol).
什么是在angularjs使用https的方式。感谢你所回答。
What's the way to use https in angularjs. Thanks by yours answers.
推荐答案
使用 $ HTTP
API,你通常会:
Use the $http
api as you would normally:
$http.get('/someUrl').success(successCallback);
如果被服务过你的应用程序HTTPS那么你拨打任何电话都是相同的主机/端口等也是如此通过HTTPS。
if your app is being served over HTTPS then any calls you are making are to the same host/port etc so also via HTTPS.
如果您使用完整的URI为您的要求例如 $ http.get('http://foobar.com/somePath')
那么你将不得不改变你的URI来使用 HTTPS
If you use the full URIs for your requests e.g. $http.get('http://foobar.com/somePath')
then you will have to change your URIs to use https
这篇关于如何使用AngularJS HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!