# CanDeactivateGuard

**Kind:** Class

**Source:** `Frontend/src/app/pipes/CanDeactivateGuard.ts` (line 12)

**Part of:** [Frontend](subsystem-frontend-src-app)

`CanDeactivateGuard` determines whether a route or view can be deactivated. Its `canDeactivate()` method returns a boolean that calling code can use to allow or block navigation away from the current state.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `canDeactivate` | `canDeactivate(component: ComponentCanDeactivate, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot)` | `boolean` |

## Diagram

```mermaid
graph LR
  A[Navigation request] --> B[CanDeactivateGuard]
  B --> C[canDeactivate()]
  C --> D{Boolean result}
  D -->|true| E[Allow deactivation]
  D -->|false| F[Block deactivation]
```

## Usage

```ts
import { CanDeactivateGuard } from './pipes/CanDeactivateGuard';

const guard = new CanDeactivateGuard();

if (guard.canDeactivate()) {
  // Continue with navigation or cleanup.
} else {
  // Keep the current view active.
}
```

## AI Coding Instructions

- Keep `canDeactivate()` returning a boolean so callers can make a direct allow-or-block decision.
- Update navigation integration when changing the guard's deactivation behavior.
- Avoid adding side effects to `canDeactivate()` unless the calling flow expects them.
- Test both `true` and `false` outcomes in code that depends on this guard.

## Used by

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

### Imported by (26)

- `AppRoutingModule` — `Frontend/src/app/app-routing.module.ts`:1
- `TranslateHandler` — `Frontend/src/app/app.module.ts`:1
- `MrqModule` — `Frontend/src/app/components/MRQ/mrq.module.ts`:1
- `BlogsModule` — `Frontend/src/app/components/blogs/blogs.module.ts`:1
- `ConfigurationRoutingModule` — `Frontend/src/app/components/configuration/configuration-routing.module.ts`:1
- `ActivitiesRouteModule` — `Frontend/src/app/components/dashboard/activities-route.module.ts`:1
- `DashboardModule` — `Frontend/src/app/components/dashboard/dashboard.module.ts`:1
- `TasksRouteModule` — `Frontend/src/app/components/dashboard/tasks-route.module.ts`:1

…and 18 more.
