angular - How to send data to an angular application when calling it from another JSP page?
问题描述
I have a JSP from which i'm loading my Angular 8 application in an Iframe. I want to send Json data to the angular applicaton when calling it in the iframe and use this data in my angular application.
I treid to make a call from
ngOnInit() in app.component.ts
But, i don't want to place a request after loading the angular application, i need the data to come in the application when i call the application in JSP IFRAME.
My JSP
<fieldset class="fieldsetblue"><legend >UI Angular Application</legend>
<form method="post" action="<c:out value="${URL}"/>" target="Tool">
</form>
<iframe WIDTH=950 HEIGHT=650 frameBorder=0 marginHeight=0 marginWidth=0 scrolling="auto">
</iframe>
</fieldset>
解决方案
尝试使用 queryParams 传递 JSON 字符串。使用 onInit() 解析它。很好的例子 - https://alligator.io/angular/query-parameters/
推荐阅读
- reverse-proxy - 使用 Traefik 的反向代理:如何在 URL mydom.com/subfolder01 和 mydom.com/subfolder02 中路由子文件夹
- javascript - javascript中switch语句中预期的声明或语句
- c++ - Xcode - 终端程序的 C++ 代码将无法运行
- javascript - 多人连接onicecandidate事件不会触发
- python - 使用 Pulp 进行线性规划 - 约束分配
- c - 如何使用 CMake 复制现代 IDE 的“构建和运行”功能?
- wordpress - 开发网站时如何将 Figma 中的 px 比例转换为实际屏幕尺寸
- laravel - 在控制器内模拟服务类
- vb.net - 如何在 Visual Basic 中正确添加十六进制数字?
- sql - 标准sql中的复合百分比