MCPcopy Index your code
hub / github.com/angular/angular / Navigation

Class Navigation

adev/src/app/core/layout/navigation/navigation.component.ts:40–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 styleUrls: ['./navigation.component.scss', './mini-menu.scss', './nav-item.scss'],
39})
40export class Navigation {
41 private readonly document = inject(DOCUMENT);
42 private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
43 private readonly navigationState = inject(NavigationState);
44 private readonly router = inject(Router);
45 private readonly location = inject(Location);
46 private readonly themeManager = inject(ThemeManager);
47 private readonly isSearchDialogOpen = inject(IS_SEARCH_DIALOG_OPEN);
48 private readonly versionManager = inject(VersionManager);
49
50 protected PAGE_PREFIX = PAGE_PREFIX;
51 protected ngLinks = ANGULAR_LINKS;
52 protected readonly PRIMARY_NAV_ID = PRIMARY_NAV_ID;
53 protected readonly SECONDARY_NAV_ID = SECONDARY_NAV_ID;
54
55 // We can't use the ActivatedRouter queryParams as we're outside the router outlet
56 protected readonly isUwu = 'location' in globalThis ? location.search.includes('uwu') : false;
57
58 protected miniMenuPositions = [
59 new ConnectionPositionPair(
60 {originX: 'end', originY: 'center'},
61 {overlayX: 'start', overlayY: 'center'},
62 ),
63 new ConnectionPositionPair(
64 {originX: 'end', originY: 'top'},
65 {overlayX: 'start', overlayY: 'top'},
66 ),
67 ];
68
69 readonly APPLE_SEARCH_LABEL = `⌘`;
70 readonly DEFAULT_SEARCH_LABEL = `ctrl`;
71
72 readonly activeRouteItem = this.navigationState.primaryActiveRouteItem;
73 protected readonly theme = this.themeManager.theme;
74 protected readonly openedMenu = signal<MenuType | null>(null);
75
76 protected readonly currentDocsVersion = this.versionManager.currentDocsVersion;
77 protected readonly currentDocsVersionMode = this.versionManager.currentDocsVersionMode;
78
79 // Set the values of the search label and title only on the client, because the label is user-agent specific.
80 protected searchLabel = this.isBrowser
81 ? isApple
82 ? this.APPLE_SEARCH_LABEL
83 : this.DEFAULT_SEARCH_LABEL
84 : '';
85 protected searchTitle = this.isBrowser
86 ? isApple
87 ? `${COMMAND} ${SEARCH_TRIGGER_KEY.toUpperCase()}`
88 : `${CONTROL} ${SEARCH_TRIGGER_KEY.toUpperCase()}`
89 : '';
90 protected versions = this.versionManager.versions;
91
92 protected isMobileNavigationOpened = this.navigationState.isMobileNavVisible;
93 isMobileNavigationOpened$ = toObservable(this.isMobileNavigationOpened);
94 primaryRouteChanged$ = toObservable(this.activeRouteItem);
95
96 constructor() {
97 this.listenToRouteChange();

Callers

nothing calls this directly

Calls 4

injectFunction · 0.90
isPlatformBrowserFunction · 0.90
signalFunction · 0.90
toObservableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…