And*_*dre 4 javascript iframe firefox routes angularjs
我有一种感觉,我错过了一些明显的东西,但我无法使用 Angular.js 路由使 iframe 在 Firefox 中工作。
该index.html
文件包含ng-view
加载main.html
:
<div>
Main content here
<iframe src="#/child"></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
iframe 指向/child
路由,为其$routeProvider
配置加载child.html
模板:
angular.module('testappApp', [])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html'
})
.when('/child', {
templateUrl: 'views/child.html'
})
.otherwise({
redirectTo: '/'
});
});
Run Code Online (Sandbox Code Playgroud)
这适用于 Chrome 和 Safari,但不适用于 Firefox 和 IE 10(我认为早期版本的 IE 也无法使用)。我感谢任何帮助,谢谢!
@jpmorin 所以,我刚刚找到了一个解决方法,这有点受您之前建议的启发。所以,当我从改变的iframe源#/child
到index.html/#/child
,一切正常!不需要多次包含 angular 等。我不完全理解为什么原始路由在 FF 中失败,但直接指向引导应用程序的文件,然后添加路由有效。
归档时间: |
|
查看次数: |
3926 次 |
最近记录: |