【发布时间】:2016-11-25 15:01:12
【问题描述】:
我想重定向并将一些数据传递到其他页面。但不使用查询字符串并且不在 URL 中传递数据
(function() {
var app = angular.module('PlateformApp', [])
app.controller('PlateformController', function ($scope,$window) {
//This will hide the DIV by default.
$scope.IsVisible = false;
$scope.ShowHide = function (platform) {
//If DIV is visible it will be hidden and vice versa.
$scope.IsVisible = $scope.IsVisible ? true : true;
//alert(platform);
document.getElementById("platform").value = platform;
var myEl = angular.element( document.querySelector( '#plat_val' ) );
myEl.text(platform);
}
$scope.storeAppWindow = function()
{
//store_url = $scope.storeUrl;
test_bc_url = ""
text_sh_url = ""
platform_val = document.getElementById("platform").value;
$http.get("/user/installedapp")
.then(function(response) {
$scope.myWelcome = response.data;
});
if (platform_val == "BC")
$window.open(test_bc_url, "popup", "width=500,height=400,left=10,top=50");
else if (platform_val == "Sh")
$window.open(text_sh_url, "popup", "width=500,height=400,left=10,top=50");
}
});
})();
在这里它将打开新窗口,但我想在另一个页面中传递 platform_val text_sh_url url。我在 python 中使用烧瓶。
【问题讨论】:
-
它只是将数据传递给angularjs中的另一个控制器吗??
-
我要发送数据到其他页面
-
这只是意味着您需要将数据传递给该特定页面的控制器,您可以使用本地存储或通过创建服务来完成。
-
如果可能的话,你能给我一个如何创建服务的例子。
-
很抱歉@piyush 回复晚了,这真的很简单,所以我想你可能已经明白了。反正我已经在下面回答了,希望对你有帮助