# MenuSettings

**Kind:** Class

**Source:** `Pams/Web/Pams.Web/Client/app/components/shared/app-menu/menu.settings.ts` (line 19)

**Part of:** [Pams](subsystem-pams)

`MenuSettings` supports URL-based behavior in the shared application menu. It searches for a URL through `searchforURL()` and exposes `CompareUrl()` to report whether the current URL matches the menu settings.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `CompareUrl` | `CompareUrl(url: string, val: string)` | `boolean` |
| `searchforURL` | `searchforURL(url: string)` | `void` |

## Properties

| Property | Type |
|---|---|
| `root` | `MenuModel[]` |

## Diagram

```mermaid
graph LR
  Menu[App Menu Component] --> Settings[MenuSettings]
  Settings --> Search[searchforURL()]
  Search --> Compare[CompareUrl()]
  Compare --> Match[boolean result]
```

## Usage

```ts
import { MenuSettings } from './menu.settings';

declare const menuSettings: MenuSettings;

menuSettings.searchforURL();

if (menuSettings.CompareUrl()) {
  // Handle the menu item that matches the current URL.
}
```

## AI Coding Instructions

- Call `searchforURL()` before relying on URL-related menu state when the current route changes.
- Preserve the existing method casing: `CompareUrl()` and `searchforURL()` are distinct API names.
- Treat the result of `CompareUrl()` as a boolean condition for menu selection or visibility logic.
- Keep URL comparison behavior within `MenuSettings` rather than duplicating matching logic in menu components.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `AppMenuComponent` — `Pams/Web/Pams.Web/Client/app/components/shared/app-menu/app-menu.component.ts`:1
- `SideMenuComponent` — `Pams/Web/Pams.Web/Client/app/components/shared/side-menu/side-menu.component.ts`:1
