2

I need to redirect to another page in angular js.

As , i have used following code to redirect. But is seems that is passing data through URL.

Need to post data to redirection URL.

Searched lot, but didn't find any solution.

Your help is highly appreciated.

$location.path('/refer').search({mobile: mobileNumber});
Prashant G Patil
  • 927
  • 1
  • 8
  • 22
  • Actually you want to pass data through controllers (the old and the new)? – P.S. Sep 21 '17 at 09:51
  • [This question](https://stackoverflow.com/questions/16003188/can-i-trigger-a-form-submit-from-a-controller) highlights the required use-case. You need to submit a form with hidden inputs to create a POST like effect. – 31piy Sep 21 '17 at 09:52

2 Answers2

0

You can use state params to pass data to another as shown below:

JS:

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

View:

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

Hope this helps..

Raghav
  • 1,139
  • 4
  • 15
  • 35
0

you can use below. for this you need to inject $state

$state.go("refer", {"mobile" : mobileNumber}); 
Sangram Badi
  • 4,054
  • 9
  • 45
  • 78