Skip to content

@scribe-atp/angular

Injectable service (provided in root) with methods that return cold Observables. The fetch starts when you subscribe and is cancelled when you unsubscribe.

import { inject } from '@angular/core';
import { ScribeService } from '@scribe-atp/angular';
const scribe = inject(ScribeService);
getSite(author: string, publicationUrl: string): Observable<Site>
Parameter Type Description
author string Author handle or DID
publicationUrl string The site’s canonical HTTPS URL, e.g. "https://alice.bsky.social"

Returns a cold Observable. Subscribe with the async pipe for automatic unsubscription on component destroy.

getArticle(author: string, articleSlug: string): Observable<Article>
Parameter Type Description
author string Author handle or DID
articleSlug string Article rkey / slug

function injectSite(author: string, publicationUrl: string): {
site: Signal<Site | null>;
loading: Signal<boolean>;
error: Signal<Error | null>;
}

Injection function (must be called in an injection context). Fetches a site immediately and returns readonly signals. The request is aborted when the host component is destroyed.

Parameter Type Description
author string Author handle or DID
publicationUrl string The site’s canonical HTTPS URL, e.g. "https://alice.bsky.social"

function injectArticle(author: string, articleSlug: string): {
article: Signal<Article | null>;
loading: Signal<boolean>;
error: Signal<Error | null>;
}

Injection function (must be called in an injection context). Fetches an article immediately and returns readonly signals. The request is aborted when the host component is destroyed.

Parameter Type Description
author string Author handle or DID
articleSlug string Article rkey / slug

function injectPublicationUri(author: string, publicationUrl: string): {
uri: Signal<string | null>;
loading: Signal<boolean>;
error: Signal<Error | null>;
}

Injection function. Resolves just the AT URI of a site record — wraps resolvePublicationUri from @scribe-atp/core — without fetching the full Site object. The request is aborted when the host component is destroyed.

Parameter Type Description
author string Author handle or DID
publicationUrl string The site’s canonical HTTPS URL

Use this when all you need is the AT URI to pass to @scribe-atp/social’s SubscribeButton, and fetching (and re-rendering on) the full site object would be wasted work.


function injectDocumentUri(
author: string,
publicationUrl: string,
articleSlug: string
): {
uri: Signal<string | null>;
loading: Signal<boolean>;
error: Signal<Error | null>;
}

Injection function. Resolves just the AT URI of an article record — internally calls fetchArticleBySlug from @scribe-atp/core and returns only the uri, discarding the article body. The request is aborted when the host component is destroyed.

Parameter Type Description
author string Author handle or DID
publicationUrl string The site’s canonical HTTPS URL
articleSlug string Article rkey / slug

Use this when all you need is the AT URI to pass to @scribe-atp/social’s LikeButton or ShareButton, typically alongside injectArticle when you’re already rendering the full article elsewhere and don’t want a second full fetch just for the URI.


All types from @scribe-atp/core are re-exported:

import type { Site, Article, ArticleRef, SiteGroup } from '@scribe-atp/angular';

See the core reference for type definitions.