I hade a page with a list of orders and search button and i want the URL change depends on the search result I used $location.search and it works but I don't know how to implement it in my app.js in page URL , I want to add it to the URL so when the user clicks on back button he gets the filtering list again
this is my controller
function openPage (key,value,key1,value1) {
$location.search(key, value);
var params = $location.search();
}
this is my app.js and it didn't work
.state('qa-dashboard.orders-list', {
url: "/orders-list/?params",
module: "private",
templateUrl: "app/qa-dashboard/orders/orders-list/orders-list.html",
controller: 'OrdersListCtrl',
my controller with the search function , i call this function first thing when user enter the page
function searchOrdersValue(){
console.log(QaDashboardService.searchValue);
if ( QaDashboardService.searchValue == 'pendeing'|| QaDashboardService.searchValue == 'problem'){
model.status =QaDashboardService.searchValue;
model.searchOrders();
}
else if (QaDashboardService.searchValue !== ''){
if (isStringNumber(QaDashboardService.searchValue)){
console.log('enter number')
model.filterByNumber =QaDashboardService.searchValue;
model.searchOrders()
}
else {
model.startFrom= QaDashboardService.searchValue;
model.startTo=QaDashboardService.searchValue1;
model.searchOrders()
}
}
if (model.status !==''){
QaDashboardService.searchValue= ($stateParams.status) ? $stateParams.status: '';
}
else if (model.startFrom !== ''){
QaDashboardService.searchValue= ($stateParams.startFrom) ? $stateParams.startFrom: '';
QaDashboardService.searchValue1= ($stateParams.startTo) ? $stateParams.startTo: '';
}
else {
QaDashboardService.searchValue= ($stateParams.filterByNumber) ? $stateParams.filterByNumber: '';
}