I'm currently in the process of developing a single page angular application.
This app retrieves a token from the URL and then sends it to an API. At the moment, my URL structure is as follows:
www.example.com/?token=3d2b9bc55a85b641ce867edaac8a979173d4446525230290fc86a0ed8ff18b95
While my code is effectively utilizing angular routes, I need to extract the token from the URL using this method:
var postToken = $location.search().token;
In my configuration, I have set up the following:
app.config(function($locationProvider, $httpProvider, $routeProvider) {
$routeProvider
.when('/token/:token', {
templateUrl : 'views/select-token.html',
controller : 'selectHold'
})
.when('/purchase-hold/token/:token', {
templateUrl : 'views/purchase-token.html',
controller : 'purchaseHold'
});
});
My objective is to structure my URL like this:
www.example.com/token/3d2b9bc55a85b641ce867edaac8a979173d4446525230290fc86a0ed8ff18b95
How can I modify my code to search for /token/
and retrieve the corresponding data, instead of using ?token=
?