2017-09-21 54 views
2

我需要重定向到角度js中的另一個頁面。角度js頁面重定向與發佈數據

因爲我已經使用下面的代碼來重定向。但似乎是通過URL傳遞數據。

需要將數據發佈到重定向URL。

搜了很多,但沒有找到任何解決方案。

非常感謝您的幫助。

$location.path('/refer').search({mobile: mobileNumber}); 
+0

其實你想通過控制器(舊的和新的)傳遞數據? –

+0

[此問題](https://stackoverflow.com/questions/16003188/can-i-trigger-a-form-submit-from-a-controller)強調了所需的用例。你需要提交一個帶有隱藏輸入的表單來創建一個類似POST的效果。 – 31piy

回答

0

您可以使用狀態PARAMS將數據傳遞給另一個,如下圖所示:

JS:

.state('dashboard',{ 
    url: '/dashboard', 
    templateUrl: 'views/dashboard.html', 
    controller: 'dashboardCtrl', 
    params : { areaName : null, city : null}   
}) 

查看:

<a ui-sref="customer.app.dashboard({areaName:area.area_name,city:area.city_id.city_name})"> 

希望這有助於..

0

你可以使用belo W上。爲此,你需要注入$state

$state.go("refer", {"mobile" : mobileNumber}); 
相關問題