首页 > 解决方案 > 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>

标签: angularresthttpjspangular-fullstack

解决方案


尝试使用 queryParams 传递 JSON 字符串。使用 onInit() 解析它。很好的例子 - https://alligator.io/angular/query-parameters/


推荐阅读