角2中的HTTP请求的Ajax调用

时间:2022-10-07 15:24:55

I am trying to load some user data from database to my angular 2 page. I am doing the angular 2 as separate application and using ReST APIs for get data. My back-end is designed using spring and spring boot and maven tool. So when I am using my angular 2 page, is it possible to load my data from spring boot micro services using Ajax call? Angular 2 supporting Ajax call for HTTP request?. If possible, can anyone share any reference link for exploring the Ajax with http request in angular 2?

我正在尝试从数据库加载一些用户数据到我的角2页。我正在做的角2作为独立的应用程序和使用ReST api获取数据。我的后端是使用spring和spring boot以及maven工具设计的。因此,当我使用我的角2页时,是否可能使用Ajax调用从spring boot micro services加载数据?角2支持HTTP请求的Ajax调用?如果可能的话,任何人都可以共享任何参考链接来使用角2中的http请求来研究Ajax吗?

1 个解决方案

#1


2  

So when I am using my angular 2 page, is it possible to load my data from spring boot micro services using Ajax call?

因此,当我使用我的角2页时,是否可能使用Ajax调用从spring boot micro services加载数据?

Yes, that's what Angular is built for, single page applications which calls back Restful services for data. Only thing is I wouldn't phrase it as AJAX call (sounds like an old school :) ) I would rather call it as REST service call.

是的,这就是为使用单页面应用程序构建的,单页面应用程序为数据调用Restful服务。唯一的问题是,我不会把它写成AJAX调用(听起来像一个古老的学校:),我宁愿把它称作REST服务调用。

Angular 2 supporting Ajax call for HTTP request?

角2支持HTTP请求的Ajax调用?

Yes it does, that's what Angular is built for

是的,这就是角的作用

If possible, can anyone share any reference link for exploring the Ajax with http request in angular 2?

如果可能的话,任何人都可以共享任何参考链接来使用角2中的http请求来研究Ajax吗?

Any sample Angular App with a backend will serve as an example. You will be able to find lots of examples by just googling it. Even if I am providing the code here, it will become irrelevant overtime as angular library itself is evolving. So, I would say, wise thing to do is, check their official website (angular.io, not angularjs that's angular 1.X, ancient stuff) and look for http call examples (eg. tour of heroes project).

任何带后端角的示例应用程序都可以作为示例。你可以通过谷歌搜索找到很多例子。即使我在这里提供代码,随着角库本身的发展,它也会变得无关紧要。所以,我想说的是,明智的做法是,检查他们的官方网站。io,不是角1。查找http调用示例(例如。英雄之旅项目)。

#1


2  

So when I am using my angular 2 page, is it possible to load my data from spring boot micro services using Ajax call?

因此,当我使用我的角2页时,是否可能使用Ajax调用从spring boot micro services加载数据?

Yes, that's what Angular is built for, single page applications which calls back Restful services for data. Only thing is I wouldn't phrase it as AJAX call (sounds like an old school :) ) I would rather call it as REST service call.

是的,这就是为使用单页面应用程序构建的,单页面应用程序为数据调用Restful服务。唯一的问题是,我不会把它写成AJAX调用(听起来像一个古老的学校:),我宁愿把它称作REST服务调用。

Angular 2 supporting Ajax call for HTTP request?

角2支持HTTP请求的Ajax调用?

Yes it does, that's what Angular is built for

是的,这就是角的作用

If possible, can anyone share any reference link for exploring the Ajax with http request in angular 2?

如果可能的话,任何人都可以共享任何参考链接来使用角2中的http请求来研究Ajax吗?

Any sample Angular App with a backend will serve as an example. You will be able to find lots of examples by just googling it. Even if I am providing the code here, it will become irrelevant overtime as angular library itself is evolving. So, I would say, wise thing to do is, check their official website (angular.io, not angularjs that's angular 1.X, ancient stuff) and look for http call examples (eg. tour of heroes project).

任何带后端角的示例应用程序都可以作为示例。你可以通过谷歌搜索找到很多例子。即使我在这里提供代码,随着角库本身的发展,它也会变得无关紧要。所以,我想说的是,明智的做法是,检查他们的官方网站。io,不是角1。查找http调用示例(例如。英雄之旅项目)。