1

I have following format url returned from payment gateway:

#/app/booking/details?id=25&success=true&paymentId=123&token=xx2311&PayerID=QSWAA

Currently my route config as follow:

.state('app.booking.details', {
                url: '/details/:id/:paymentId',
                views: {
                    'mainView@app': {
                        templateUrl: 'views/details_booking.html'

                    }
                },
                css: ['assets/css/styles.css','assets/css/plugins.css'],
                resolve: loadSequence('bookingCtrl')


            })

Unfortunately I can't separate the url and pass it to server. How can I resolve these. So far only id is able to pass through. These are my Laravel 5.1 method:

public function getBookingDetailAPI(Request $request)
    {

        $oid = $request->input('paymentId'); --> null
        $oid = $request->input('id'); --> 25
        dd($oid);
  }

1 Answer 1

1

Your state url options of state should be changed to below as you are looking for query parameter from the URL.

url: '/details?id&paymentId&token&PayerID'

By this change you could get the URL parameter by $stateParams service injecting it into a controller like $stateParams.id, $stateParams.paymentId, etc.

Once you have that, you can then forward your request to your laravel server in your controller or resolve method, like this:

$http.get('/backend/route',{params:$stateParams}).then(function(data){
  console.log(data); // laravel response
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.