
[英]Can we select <a> element when it's routerLink is active in angular?
[英]Can we manipulate Angular routerlink redirection from an external code base?
我的代码位于由 Angular 框架包裹的 Iframe 上。 我想防止 Angular routerLink 在用户单击浏览器上的任何链接时被调用。 基本上防止重定向并在我的代码中调用一些函数。 是否可以从我的代码库本身做到这一点?
我在元素上尝试了 e.preventDefault() 和 javascript:void(0) ,将href更改为“#”或完全删除href,但重定向仍然发生。
答案是不。 iFrame 不能影响其父应用程序的行为。 (反过来也是不可能的)。
这可能是出于安全原因,如果您考虑一下,这是有道理的。 Let's say facebook has an iFrame, so my iFrame would affect the behaviour of the whole facebook page... that would be bad.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.