diff --git a/docs/en/UI/Angular/Modifying-the-Menu.md b/docs/en/UI/Angular/Modifying-the-Menu.md index dba2c9be91..938d490e6f 100644 --- a/docs/en/UI/Angular/Modifying-the-Menu.md +++ b/docs/en/UI/Angular/Modifying-the-Menu.md @@ -241,7 +241,7 @@ After adding the `routes` property as described above, the navigation menu looks ## How to Patch or Remove a Navigation Element -The `patch` method of `RoutesService` finds a route by its name and replaces its configuration with the new configuration passed as the second parameter. Similarly, `remove` method finds a route and removes it along with its children. Also you can use `removeByParams` method to delete the routes with given properties. +The `patch` method of `RoutesService` finds a route by its name and replaces its configuration with the new configuration passed as the second parameter. Similarly, `remove` method finds a route and removes it along with its children. Also you can use `removeByParam` method to delete the routes with given properties. ```js // this.routes is instance of RoutesService @@ -266,7 +266,7 @@ this.routes.patch('::Menu:Home', newHomeRouteConfig); this.routes.remove(['Your navigation']); // or -this.routes.removeByParams({ name: 'Your navigation' }); +this.routes.removeByParam({ name: 'Your navigation' }); ``` - Moved the _Home_ navigation under the _Administration_ dropdown based on given `parentName`. diff --git a/npm/ng-packs/packages/core/src/lib/services/routes.service.ts b/npm/ng-packs/packages/core/src/lib/services/routes.service.ts index 6837e57aca..393c724423 100644 --- a/npm/ng-packs/packages/core/src/lib/services/routes.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/routes.service.ts @@ -152,7 +152,7 @@ export abstract class AbstractTreeService): T[] | null { + removeByParam(params: Partial): T[] | null { if (!params) { return null; } @@ -168,7 +168,7 @@ export abstract class AbstractTreeService); + this.removeByParam({ [this.parentId]: item[this.id] } as Partial); } const flatItems = this.flat.filter(item => !excludedList.includes(item)); diff --git a/npm/ng-packs/packages/core/src/lib/tests/routes.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/routes.service.spec.ts index a751b84d6d..affd15e873 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/routes.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/routes.service.spec.ts @@ -300,11 +300,11 @@ describe('Routes Service', () => { }); }); - describe('#removeByParams', () => { + describe('#removeByParam', () => { it('should remove route based on given route', () => { service.add(routes); - service.removeByParams({ + service.removeByParam({ name: 'bar', parentName: 'foo', }); @@ -333,7 +333,7 @@ describe('Routes Service', () => { }, ]); - service.removeByParams({ + service.removeByParam({ path: '/foo/bar', name: 'bar', parentName: 'foo', @@ -360,7 +360,7 @@ describe('Routes Service', () => { service.add(routes); const flatLengthBeforeRemove = service.flat.length; - service.removeByParams({ + service.removeByParam({ name: 'bar', parentName: 'baz', });