$location.path 在弹出式浏览器中不起作用 window
$location.path does not work in popup browser window
在我的 JavaScript Excel 插件中,我使用 window.open("https://localhost:3000/#/posts/editor/", "popup", "width=1000, height=1100")
弹出浏览器 window。
我意识到,与普通浏览器不同,我们无法在此弹出式浏览器中手动修改 URL window。
这个页面是由angularjs
建立的,我在这个页面中有一个保存按钮,它链接到以下功能:
$scope.save = function () {
posts.create({ title: "newCreated", link: "" })
.success(function (post) {
$location.path("/posts/editor/" + post._id)
})
})
我知道 $location.path
不会重定向此弹出窗口中的页面 window。而在普通浏览器中,$location.path
有效。
有谁知道是否可以解锁弹出式浏览器 window 以便 $location.path
工作?
尝试$rootScope.$apply
或$scope.$apply()
$scope.save = function () {
posts.create({ title: "newCreated", link: "" })
.success(function (post) {
$rootScope.$apply(function() {
$location.path("/posts/editor/" + post._id)
console.log($location.path());
});
})
})
在我的 JavaScript Excel 插件中,我使用 window.open("https://localhost:3000/#/posts/editor/", "popup", "width=1000, height=1100")
弹出浏览器 window。
我意识到,与普通浏览器不同,我们无法在此弹出式浏览器中手动修改 URL window。
这个页面是由angularjs
建立的,我在这个页面中有一个保存按钮,它链接到以下功能:
$scope.save = function () {
posts.create({ title: "newCreated", link: "" })
.success(function (post) {
$location.path("/posts/editor/" + post._id)
})
})
我知道 $location.path
不会重定向此弹出窗口中的页面 window。而在普通浏览器中,$location.path
有效。
有谁知道是否可以解锁弹出式浏览器 window 以便 $location.path
工作?
尝试$rootScope.$apply
或$scope.$apply()
$scope.save = function () {
posts.create({ title: "newCreated", link: "" })
.success(function (post) {
$rootScope.$apply(function() {
$location.path("/posts/editor/" + post._id)
console.log($location.path());
});
})
})