javascript 在 SPA 应用程序中使用 AngularJs 在 ng-view 中加载外部页面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20597141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 18:50:45  来源:igfitidea点击:

Load external page inside ng-view with AngularJs in an SPA application

javascriptangularjssingle-page-applicationangular-routing

提问by l2mt

Is there a way of insert an external web page inside angularjs ng-view. For example when I press a link with ng-routein my example I want that a external page load inside my own web page.

有没有办法在 angularjs 中插入外部网页ng-view。例如,当我按下示例中的链接时ng-route,我希望在我自己的网页中加载外部页面。

In this example, I wish that when I click external, another page should be loaded. I have tried with ng-include and doesn't work.

在这个例子中,我希望当我点击外部时,应该加载另一个页面。我已经尝试过 ng-include 并且不起作用。

http://plnkr.co/edit/vkAvZ2hGUjHlfHy0ul1z

http://plnkr.co/edit/vkAvZ2hGUjHlfHy0ul1z

Thanks for your help.

谢谢你的帮助。

采纳答案by Tasos Bitsios

Why not just use an iframe inside your partial template? (second.html)

为什么不在部分模板中使用 iframe 呢?(第二个.html)

http://plnkr.co/edit/DngozsvRhvJ3Ssr0amzK

http://plnkr.co/edit/DngozsvRhvJ3Ssr0amzK