Questions tagged «rerender»

13
如何使用AngularJS重新加载或重新渲染整个页面
在基于几个用户上下文渲染了整个页面并提出了几个$http请求之后,我希望用户能够切换上下文并再次重新渲染所有内容(重新发送所有$http请求等)。如果我只是将用户重定向到其他地方,则一切正常: $scope.on_impersonate_success = function(response) { //$window.location.reload(); // This cancels any current request $location.path('/'); // This works as expected, if path != current_path }; $scope.impersonate = function(username) { return auth.impersonate(username) .then($scope.on_impersonate_success, $scope.on_auth_failed); }; 如果使用$window.location.reload(),则正在等待响应的$http请求中的某些请求auth.impersonate(username)将被取消,因此无法使用它。此外,骇客$location.path($location.path())也无法运作(一无所获)。 还有另一种方法可以重新渲染页面,而无需再次手动发出所有请求吗?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.