Skip to content

Commit

Permalink
pass $state.params in list only if it is the same entity
Browse files Browse the repository at this point in the history
  • Loading branch information
ThieryMichel committed May 12, 2015
1 parent 591a7ed commit 692a9c1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/javascripts/ng-admin/Crud/button/maListButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ define(function () {
},
link: function (scope) {
scope.label = scope.label || 'List';
var parentEntityName = scope.$parent.entity ? scope.$parent.entity.name() : null;
var entityName = scope.entity().name();

var params = {
entity: entityName
};
if (entityName === parentEntityName) {
angular.extend(params, $state.params);
}

scope.gotoList = function () {
$state.go($state.get('list'), {
entity: scope.entity().name(),
search: $state.params.search,
page: $state.params.page,
sortDir: $state.params.sortDir,
sortField: $state.params.sortField
});
$state.go($state.get('list'), params);
};
},
template:
Expand Down

0 comments on commit 692a9c1

Please sign in to comment.