fixed search pagination url issue

This commit is contained in:
John Mitchell 2016-10-06 16:13:38 -04:00
parent 4a4c55a75c
commit f35fcf86e7
2 changed files with 23 additions and 2 deletions

View File

@ -71,7 +71,27 @@ export default
// if you're editing an object, make sure you're on the right
// page to display the element you are editing
if (scope.addedItem) {
if (params.fromSearch) {
var url = params.url;
// for a search, we want to make sure to get the first page of
// results
if (url.indexOf("page=") > -1) {
// if the url includes a page, remove that part
var urlArr = url.split("page=");
var afterPageUrlArr = urlArr[1].split("&");
if (afterPageUrlArr.length > 1) {
// if there's stuff after the page part,
// put that back in
afterPageUrlArr.shift();
url = urlArr[0] +
afterPageUrlArr.join("&");
} else {
url = urlArr[0];
}
}
getPage(url);
} else if (scope.addedItem) {
id = scope.addedItem + "";
delete scope.addedItem;
$rootScope.rowBeingEdited = id;

View File

@ -72,7 +72,8 @@ export default ['$scope', 'Refresh', 'tagSearchService', '$stateParams',
scope: listScope,
set: set,
iterator: iterator,
url: url
url: url,
fromSearch: true
});
listScope.$on('PostRefresh', function() {