angular - 如何从 iframe 向 Angular 应用程序传递值
问题描述
我有带有路线的 Angular 9 应用程序。
它嵌入到 iframe 中的 ASP.NET 应用程序中(我无法控制此设置,Angular 的/dist
文件夹位于 ASP.NET 应用程序的文件夹结构中)。
一切正常,但新的要求是默认加载显式路由。
这是当前的设置:
<iframe src="[path]/index.html" />
寻找类似下面的东西(它会爆炸Error: Cannot match any routes. URL Segment: 'index.html'
)
<iframe src="[path]/index.html?r=whatever" />
问题:如何将值从其父 iframe 传递给 angular?(index.html
必须在 中src
,这似乎是 Angular 方面的主要问题)
解决方案
您可以将事件发送到 iframe 并在 Angular 应用程序中对这些事件做出反应。
推荐阅读
- r - 可以改进 R 包 readODS,因为它在安装期间在 Linux 上给出错误
- reactjs - 来自嵌套序列化程序的数组未定义。还原,DRF
- javascript - 如何选中和取消选中复选框 onload 功能?
- python - 在 Python 中绘制 RidgeClassifier 的 ROC 曲线
- curl - 使用 ansible-playbook 安装 Gradel 5.4.1
- python - 我是编码本身的新手,所以我想知道如何解决这个问题
- flutter - 按下退格键时如何删除TextFormField中的连续删除文本?
- ubuntu-18.04 - 安装 timescaledb 失败
- xamarin.android - 带有 Transactor 的华为 HMS MLLocalTextAnalyzer 不从相机流返回任何结果(Xamarin)
- python - 如何在龙卷风集成中禁用 INFO jaeger 日志记录条目?