【发布时间】:2017-07-23 10:48:04
【问题描述】:
我想使用 angularjs $window 重新加载具有不同 html 页面的页面,文档说:
页面重新加载导航 $location 服务只允许您更改 URL;它不允许您重新加载页面。当您需要更改 URL 并重新加载页面或导航到不同的页面时,请使用较低级别的 API,$window.location.href。
所以我将位置设置为页面$window.location.href = '/transaction';
以及config块上的匹配路由:
app.config(function($routeProvider) {
$routeProvider
.when('/transaction', {
templateUrl : 'JavaScript/directives/modelHTML/Transaction.html',
controller : 'endProcessModelController'
});
});
但是在 Transaction.html 页面中,我收到错误 404: SRVE0190E: File not found: /transaction 的路由 mydomain.com/UI/transaction。
顺便说一句 - templateUrl url 在 UImodel 等其他地方工作正常,所以问题是我认为的导航。
【问题讨论】:
-
请参考stackoverflow链接:angularjs-how-can-i-do-a-redirect-with-a-full-page-load
标签: javascript angularjs