【发布时间】:2014-07-22 07:46:28
【问题描述】:
我正在尝试使用$route.reload() 重新加载页面:
var App = angular.module("App", ["ngRoute"]);
var idx = 0;
App.controller("List", function ($scope, $route) {
$scope.changeWallet = function (index) {
idx = index;
$route.reload();
console.log("success");
};
}
"success" 显示在控制台中,但没有任何反应。
我怎样才能解决这个问题?
【问题讨论】:
-
你在使用 ui-router 吗?
-
所以你只想刷新模板吗?
-
先从缓存中删除模板,然后尝试重新加载模板。添加这个“var currentPageTemplate = $route.current.templateUrl; $templateCache.remove(currentPageTemplate);”在重新加载函数调用之前。
-
我收到了
undefined is not an object (evaluating '$route.current.templateUrl') -
我不相信这与模板缓存有任何关系。 @supertrall 您要重新加载视图部分还是完整页面?
标签: javascript angularjs