/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
adev/src/app/features/references/api-reference-list/api-reference-manager.service.ts
50 строк
2 KB
Matthieu Riegler
docs: update guides to use `@Service`
11 май 2026, 22:38
11 май 2026, 22:38
52a8487
Код
Авторство
О чём код?
/*! * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Service, signal} from '@angular/core'; // This file is generated at build-time, error is expected here. import API_MANIFEST_JSON from '../../../../../src/assets/api/manifest.json'; import {getApiUrl} from '../helpers/manifest.helper'; import {ApiItem} from '../interfaces/api-item'; import {ApiItemsGroup} from '../interfaces/api-items-group'; import {ApiManifest} from '../interfaces/api-manifest'; const manifest = API_MANIFEST_JSON as ApiManifest; @Service() export class ApiReferenceManager { apiGroups = signal<ApiItemsGroup[]>(this.mapManifestToApiGroups()); private mapManifestToApiGroups(): ApiItemsGroup[] { const groups: ApiItemsGroup[] = []; for (const module of manifest) { groups.push({ title: module.moduleLabel.replace('@angular/', ''), id: module.normalizedModuleName, items: module.entries.map((api) => { const url = getApiUrl(module, api.name); const apiItem: ApiItem = { itemType: api.type, title: api.name, deprecated: api.deprecated, developerPreview: api.developerPreview, experimental: api.experimental, stable: api.stable, url, category: api.category, }; return apiItem; }), }); } return groups; } }