运行ng serve时将angular嵌入到spring应用程序中并访问Spring Controllers

运行ng serve时将angular嵌入到spring应用程序中并访问Spring Controllers,第1张

运行ng serve时将angular嵌入到spring应用程序中并访问Spring Controllers

为此做

this.http.get('/hello').subscribe( data => {      console.log('DATA', data);      this.message = data['message'];    });

您需要进行一些代理配置。

proxy-config.json
项目中的相同目录中创建一个文件
package.json

{    "/": {        "target": "http://localhost:8080",        "secure": false    }}

然后在

package.json
内部带有
scripts
update 之后的try 命令中运行您的项目。
"start"``"start": "ngserve --proxy-config proxy-config.json",``npm start



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5675879.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存