javascript - $rootScope.$digest 正在清除参数
问题描述
我的方法有问题window.history.pushState
。我在页面上https://localhost:1234/jobs
。我想在不重新加载页面的情况下向我的 url 添加一个参数和哈希。我有一个简单的按钮来编辑工作:
<i class="fas fa-edit fa-fw"
data-tooltip="tooltip"
title="Edit this job"
ng-click="goJobModal(job.id);$event.stopPropagation()"></i>
按此后,goJobModal
应执行job.id
$scope.goJobModal = function(jobId) {
if (jobId) {
window.history.pushState(null, "Updating job", "/jobs/?jobId=" + jobId + "#update");
console.log(window.location.href);
} else {
window.history.pushState(null, "Creating job", "/jobs#create");
}
};
我放置了一个断点console.log
来查看 pushState 之后会发生什么,我看到了一些对我来说很有趣的东西。在$rootScope.$digest
我的网址被清除为https://localhost:1234/jobs
. 我应该怎么做才能成功更改我的网址?
解决方案
推荐阅读
- r - ShinyDashboard: Long sidebarPanel 导致dashboardBody内的MainPanel出现问题
- android - 从 Gitlab CI 中的 Appcenter 下载应用中心工件
- python - 在 SGE 集群上运行 ray (tune) 的问题
- .net - JsonConverter 在集成测试中不起作用
- ios - 当在两个观察对象视图(SwiftUI)之间的导航视图中滑回时,ForEach 消失
- html - Navbar toggler is not working in Bootstrap 5
- javascript - TypeError:无法读取未定义的属性“添加”
- python - 执行可创建时的Python MySQL语法错误......就像
- javascript - 从matchip角度中的选定属性调用函数的有效方法
- jenkins - 使用 Docker 的 CI 基础架构的网络问题