Angular routing 使用“history.replace”替换为角度1.x
我需要在Angular 1.x应用程序上使用Angular routing 使用“history.replace”替换为角度1.x,angular-routing,html5-history,angularjs-ng-route,angularjs,Angular Routing,Html5 History,Angularjs Ng Route,Angularjs,我需要在Angular 1.x应用程序上使用history.replaceState的帮助 我的Chrome扩展与其他人的应用程序交互,我想在该应用程序中加载一个Url,其中包含我的扩展程序可以读取的额外查询参数,然后使用history.replaceState从Url中删除 步骤1:打开www.otherapp.com?extensionToken=MhtkWGUyS#/settings 步骤2:读取xtensionToken=MhtkWGUyS 步骤3:将令牌替换/删除为replaceSt
history.replaceState
的帮助
我的Chrome扩展与其他人的应用程序交互,我想在该应用程序中加载一个Url,其中包含我的扩展程序可以读取的额外查询参数,然后使用history.replaceState
从Url中删除
- 步骤1:打开
www.otherapp.com?extensionToken=MhtkWGUyS#/settings
- 步骤2:读取
xtensionToken=MhtkWGUyS
- 步骤3:将令牌替换/删除为
到replaceState
www.otherapp.com#/settings
history.replaceState
的经验
我想到的一个解决方案是使用Angular的$location
来更改状态,但我不知道如何访问Angular范围之外的$location
。有人知道我怎样才能得到它吗
生成对$location
的引用的棘手部分是,我的代码将与许多不同的应用程序一起运行,它们有自己独特的ng-
元素,我不知道这些元素在页面上是什么。我可以假设大多数应用程序在window.Angular
中都有Angular元素,但我不能简单地假设每个页面的Angular应用程序元素是什么