Getting Started
Writing content
Customization
Recipes
API References Develop
API Documentation Rendering API

Rendering API

NgDoc supports rendering API information in your guides.

API rendering

To render API information you can use the NgDocApi class that provides methods to generate API tables and details for the provided declaration path.

Api

The NgDocApi.api() method generates API tables for the provided declaration path.

index.md
{{ NgDocApi.api("path/from/root/to/declaration.ts#MyClassName") }}

Details

The NgDocApi.details() method generates API details with information about generic types, decorators, selectors, etc. based on the provided declaration type.

index.md
{{ NgDocApi.details("path/from/root/to/declaration.ts#MyClassName") }}

JSDoc rendering

To render JSDoc comments you can use the JSDoc class that provides methods to display JSDoc comments for the provided declaration path.

Description

The JSDoc.description() method returns the JSDoc description for the provided declaration path.

index.md
{{ JSDoc.description("path/from/root/to/declaration.ts#MyClassName") }}

Tag

The JSDoc.tag() method returns the JSDoc tag description for the provided declaration path.

index.md
{{ JSDoc.tag("path/from/root/to/declaration.ts#MyClassName", "deprecated") }}

Tags

The JSDoc.tags() returns an array of rendered JSDoc tags for the provided declaration path. You can use this list to render all tags manually using nunjucks.

index.md
{% set tags = JSDoc.tags("path/from/root/to/declaration.ts#MyClassName", "see") %}

{% for tag in tags %}
{{ tag }}
{% endfor %}

HasTag

The JSDoc.hasTag() method returns true if the provided declaration path has the specified JSDoc tag.

index.md
{{ JSDoc.hasTag("path/from/root/to/declaration.ts#MyClassName", "deprecated") }}