I'm a newbie to AngularJS and am still learning about it. I have this task where I need to capture query parameter in $stateparam. Is that possible to do?
URL as follow: https://..../details?param1=abc¶m2=10
In my ui route, I have this:
$stateProvider.state('order', {
url : '/order',
views : {
"mainContent" : {
templateUrl : 'order.html'
}
},
params: {
orderId: <how can I capture param1 value here?>,
orderQuantity: <how can I capture param2 value here?>
}
});
If not, what is other way where I can assign query param as $stateparam? This can be easily achieve if I assign parameter here
url : '/order/:param1/:param2'
But this also means my URL would be as such and I don't want that
https://..../details?param1=abc¶m2=10#!/order/abc/10
By the way, they need to be passed $stateparam as they are required for downstream and I can't modify the code.