mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs: Adds links to relevant guides for APIs in core package
(cherry picked from commit 0432e76171)
This commit is contained in:
parent
d10f1107a8
commit
daae2636d5
43 changed files with 119 additions and 4 deletions
|
|
@ -1019,7 +1019,7 @@ export interface InputFunction {
|
|||
};
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public (undocumented)
|
||||
export interface InputOptions<T, TransformT> {
|
||||
alias?: string;
|
||||
debugName?: string;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class OutputFromObservableRef<T> implements OutputRef<T> {
|
|||
* nameChange = outputFromObservable(this.nameChange$);
|
||||
* }
|
||||
* ```
|
||||
* @see [RxJS interop with component and directive outputs](ecosystem/rxjs-interop/output-interop)
|
||||
*
|
||||
* @publicApi 19.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import {Observable} from 'rxjs';
|
|||
*
|
||||
* You can subscribe to the output via `Observable.subscribe` then.
|
||||
*
|
||||
* @see [RxJS interop with component and directive outputs](ecosystem/rxjs-interop/output-interop)
|
||||
*
|
||||
* @publicApi 19.0
|
||||
*/
|
||||
export function outputToObservable<T>(ref: OutputRef<T>): Observable<T> {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ export interface RxResourceOptions<T, R> extends BaseResourceOptions<T, R> {
|
|||
* Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the
|
||||
* resource's value.
|
||||
*
|
||||
* @see [Using rxResource for async data](ecosystem/rxjs-interop#using-rxresource-for-async-data)
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export function rxResource<T, R>(
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import {takeUntil} from 'rxjs/operators';
|
|||
* passed explicitly to use `takeUntilDestroyed` outside of an [injection
|
||||
* context](guide/di/dependency-injection-context). Otherwise, the current `DestroyRef` is injected.
|
||||
*
|
||||
* @see [Unsubscribing with takeUntilDestroyed](ecosystem/rxjs-interop/take-until-destroyed)
|
||||
*
|
||||
* @publicApi 19.0
|
||||
*/
|
||||
export function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ export interface ToObservableOptions {
|
|||
*
|
||||
* `toObservable` must be called in an injection context unless an injector is provided via options.
|
||||
*
|
||||
* @see [RxJS interop with Angular signals](ecosystem/rxjs-interop)
|
||||
* @see [Create an RxJS Observable from a signal with toObservable](ecosystem/rxjs-interop#create-an-rxjs-observable-from-a-signal-with-toobservable)
|
||||
*
|
||||
* @publicApi 20.0
|
||||
*/
|
||||
export function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ export function toSignal<T, const U extends T>(
|
|||
* If the subscription should persist until the `Observable` itself completes, the `manualCleanup`
|
||||
* option can be specified instead, which disables the automatic subscription teardown. No injection
|
||||
* context is needed in this configuration as well.
|
||||
*
|
||||
* @see [RxJS interop with Angular signals](ecosystem/rxjs-interop)
|
||||
*/
|
||||
export function toSignal<T, U = undefined>(
|
||||
source: Observable<T> | Subscribable<T>,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ export const ANIMATIONS_DISABLED = new InjectionToken<boolean>(
|
|||
* The event type for when `animate.enter` and `animate.leave` are used with function
|
||||
* callbacks.
|
||||
*
|
||||
* @see [Animating your applications with animate.enter and animate.leave](guide/animations)
|
||||
*
|
||||
* @publicApi 20.2
|
||||
*/
|
||||
export type AnimationCallbackEvent = {target: Element; animationComplete: Function};
|
||||
|
|
@ -34,6 +36,7 @@ export type AnimationCallbackEvent = {target: Element; animationComplete: Functi
|
|||
* for when stylesheets are pruned.
|
||||
*
|
||||
* @publicApi 20.2
|
||||
* @see [Animating your applications with animate.enter and animate.leave](guide/animations)
|
||||
*/
|
||||
export const MAX_ANIMATION_TIMEOUT = new InjectionToken<number>(
|
||||
typeof ngDevMode !== 'undefined' && ngDevMode ? 'MaxAnimationTimeout' : '',
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import {InjectionToken} from '../di/injection_token';
|
|||
*
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request `Request` on MDN}
|
||||
*
|
||||
* @see [Accessing Request and Response via DI](guide/ssr#accessing-request-and-response-via-di)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const REQUEST = new InjectionToken<Request | null>(
|
||||
|
|
@ -51,6 +53,7 @@ export const REQUEST = new InjectionToken<Request | null>(
|
|||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/Response `ResponseInit` on MDN}
|
||||
*
|
||||
* @publicApi
|
||||
* @see [Accessing Request and Response via DI](guide/ssr#accessing-request-and-response-via-di)
|
||||
*/
|
||||
export const RESPONSE_INIT = new InjectionToken<ResponseInit | null>(
|
||||
typeof ngDevMode === 'undefined' || ngDevMode ? 'RESPONSE_INIT' : '',
|
||||
|
|
@ -69,6 +72,7 @@ export const RESPONSE_INIT = new InjectionToken<ResponseInit | null>(
|
|||
* This token is only available during server-side rendering and will be `null` in other contexts.
|
||||
*
|
||||
* @publicApi
|
||||
* @see [Accessing Request and Response via DI](guide/ssr#accessing-request-and-response-via-di)
|
||||
*/
|
||||
export const REQUEST_CONTEXT = new InjectionToken<unknown>(
|
||||
typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST_CONTEXT' : '',
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ export function inputRequiredFunction<ReadT, WriteT = ReadT>(
|
|||
* The function exposes an API for also declaring required inputs via the
|
||||
* `input.required` function.
|
||||
*
|
||||
* @see [Accepting data with input properties](guide/components/inputs)
|
||||
* @see [Required inputs](guide/components/inputs#required-inputs)
|
||||
* @see [Input transforms](guide/components/inputs#input-transforms)
|
||||
* @publicAPI
|
||||
* @docsPrivate Ignored because `input` is the canonical API entry.
|
||||
*/
|
||||
|
|
@ -85,6 +88,7 @@ export interface InputFunction {
|
|||
*/
|
||||
required: {
|
||||
/** Declares a required input of type `T`. */
|
||||
|
||||
<T>(opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;
|
||||
/**
|
||||
* Declares a required input of type `T` with a transform function.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import {INPUT_SIGNAL_NODE, InputSignalNode, REQUIRED_UNSET_VALUE} from './input_
|
|||
|
||||
/**
|
||||
* @publicAPI
|
||||
* @see [Input aliases](guide/components/inputs#input-aliases)
|
||||
* @see [Input transforms](guide/components/inputs#input-transforms)
|
||||
*
|
||||
* Options for signal inputs.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ export function modelRequiredFunction<T>(opts?: ModelOptions): ModelSignal<T> {
|
|||
* The function exposes an API for also declaring required models via the
|
||||
* `model.required` function.
|
||||
*
|
||||
* @see [Two-way binding between components](guide/templates/two-way-binding#two-way-binding-between-components)
|
||||
* @see [Model inputs](guide/components/inputs#model-inputs)
|
||||
* @see [Customizing model inputs](guide/components/inputs#customizing-model-inputs)
|
||||
*
|
||||
* @publicAPI
|
||||
* @docsPrivate Ignored because `model` is the canonical API entry.
|
||||
*/
|
||||
|
|
@ -100,6 +104,9 @@ export interface ModelFunction {
|
|||
* this.firstName.set(newFirstName);
|
||||
* }
|
||||
* ```
|
||||
* @see [Two-way binding between components](guide/templates/two-way-binding#two-way-binding-between-components)
|
||||
* @see [Model inputs](guide/components/inputs#model-inputs)
|
||||
* @see [Customizing model inputs](guide/components/inputs#customizing-model-inputs)
|
||||
*
|
||||
* @publicApi 19.0
|
||||
* @initializerApiFunction
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import {OutputEmitterRef} from './output_emitter_ref';
|
|||
/**
|
||||
* Options for declaring an output.
|
||||
*
|
||||
* @see [Customizing output names](guide/components/outputs#customizing-output-names)
|
||||
*
|
||||
* @publicApi 19.0
|
||||
*/
|
||||
export interface OutputOptions {
|
||||
|
|
@ -58,6 +60,9 @@ export interface OutputOptions {
|
|||
* this.nameChange.emit(newName);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @see [Custom events with outputs](guide/components/outputs#customizing-output-names)
|
||||
*
|
||||
* @initializerApiFunction {"showTypesInSignaturePreview": true}
|
||||
* @publicApi 19.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import {OutputRef, OutputRefSubscription} from './output_ref';
|
|||
* <my-comp (valueChange)="processNewValue($event)" />
|
||||
* ```
|
||||
*
|
||||
* @see [Custom events with outputs](guide/components/outputs)
|
||||
*
|
||||
* @publicAPI
|
||||
*/
|
||||
export class OutputEmitterRef<T> implements OutputRef<T> {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import {DestroyRef} from '../../linker/destroy_ref';
|
|||
* Note: Angular will automatically clean up subscriptions
|
||||
* when the directive/component of the output is destroyed.
|
||||
*
|
||||
* @see [Subscribing to outputs programmatically](guide/components/outputs#subscribing-to-outputs-programmatically)
|
||||
*
|
||||
* @publicAPI
|
||||
*/
|
||||
export interface OutputRefSubscription {
|
||||
|
|
@ -25,6 +27,7 @@ export interface OutputRefSubscription {
|
|||
* A reference to an Angular output.
|
||||
*
|
||||
* @publicAPI
|
||||
* @see [Subscribing to outputs programmatically](guide/components/outputs#subscribing-to-outputs-programmatically)
|
||||
*/
|
||||
export interface OutputRef<T> {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ export interface ViewChildFunction {
|
|||
*
|
||||
* @publicApi 19.0
|
||||
* @initializerApiFunction
|
||||
* @see [Referencing component children with queries](guide/components/queries)
|
||||
* @see [Required queries](guide/components/queries#required-queries)
|
||||
*/
|
||||
export const viewChild: ViewChildFunction = (() => {
|
||||
// Note: This may be considered a side-effect, but nothing will depend on
|
||||
|
|
@ -147,6 +149,8 @@ export function viewChildren<LocatorT, ReadT>(
|
|||
*
|
||||
* @initializerApiFunction
|
||||
* @publicApi 19.0
|
||||
* @see [Referencing component children with queries](guide/components/queries)
|
||||
* @see [Required queries](guide/components/queries#required-queries)
|
||||
*/
|
||||
export function viewChildren<LocatorT, ReadT>(
|
||||
locator: ProviderToken<LocatorT> | string,
|
||||
|
|
@ -310,6 +314,8 @@ export function contentChildren<LocatorT, ReadT>(
|
|||
*
|
||||
* @initializerApiFunction
|
||||
* @publicApi 19.0
|
||||
* @see [Referencing component children with queries](guide/components/queries)
|
||||
* @see [Content queries](guide/components/queries#content-queries)
|
||||
*/
|
||||
export function contentChildren<LocatorT, ReadT>(
|
||||
locator: ProviderToken<LocatorT> | string,
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ export class ChangeDetectionSchedulerImpl implements ChangeDetectionScheduler {
|
|||
* @publicApi 20.2
|
||||
*
|
||||
* @see {@link /api/platform-browser/bootstrapApplication bootstrapApplication}
|
||||
* @see [Angular without ZoneJS (Zoneless)](guide/zoneless)
|
||||
*/
|
||||
export function provideZonelessChangeDetection(): EnvironmentProviders {
|
||||
performanceMarkFeature('NgZoneless');
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import {Injector as PrimitivesInjector} from '@angular/core/primitives/di';
|
|||
* from the given `Injector`. Note that `inject` is only usable synchronously, and cannot be used in
|
||||
* any asynchronous callbacks or after any `await` points.
|
||||
*
|
||||
* @see [Run within an injection context](guide/di/dependency-injection-context#run-within-an-injection-context)
|
||||
*
|
||||
* @param injector the injector which will satisfy calls to [`inject`](api/core/inject) while `fn`
|
||||
* is executing
|
||||
* @param fn the closure to be run in the context of `injector`
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ const __forward_ref__ = getClosureSafeProperty({__forward_ref__: getClosureSafeP
|
|||
* hideParent = input.required<boolean>();
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @see [Resolve circular dependencies with a forward reference](guide/di/di-in-action#resolve-circular-dependencies-with-a-forward-reference)
|
||||
* @publicApi
|
||||
*/
|
||||
export function forwardRef(forwardRefFn: ForwardRefFn): Type<any> {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ export interface InjectableDecorator {
|
|||
* provided and injected as a dependency.
|
||||
*
|
||||
* @see [Introduction to Services and DI](guide/di)
|
||||
* @see [Dependency Injection Guide](guide/di/dependency-injection)
|
||||
* @see [Creating and using services](guide/di/creating-and-using-services)
|
||||
* @see [Defining dependency providers](guide/di/defining-dependency-providers)
|
||||
*
|
||||
* @usageNotes
|
||||
*
|
||||
|
|
@ -72,6 +73,7 @@ export interface InjectableDecorator {
|
|||
/**
|
||||
* Type of the Injectable metadata.
|
||||
*
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Injectable {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ import {ɵɵdefineInjectable} from './interface/defs';
|
|||
*
|
||||
* {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
|
||||
*
|
||||
*
|
||||
* @see [What is an InjectionToken?](guide/di/defining-dependency-providers#what-is-an-injectiontoken)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class InjectionToken<T> {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import {ProviderToken} from './provider_token';
|
|||
*
|
||||
* {@example core/di/ts/injector_spec.ts region='injectInjector'}
|
||||
*
|
||||
* @see [Types of injector hierarchies](guide/di/hierarchical-dependency-injection#types-of-injector-hierarchies)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class Injector {
|
||||
|
|
|
|||
|
|
@ -286,6 +286,8 @@ export function inject(token: HostAttributeToken, options: {optional: false}): s
|
|||
* }
|
||||
* ```
|
||||
*
|
||||
* @see [Injecting dependencies with inject()](guide/di#injecting-dependencies-with-inject)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function inject<T>(token: ProviderToken<T> | HostAttributeToken, options?: InjectOptions) {
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ interface Record<T> {
|
|||
* An `Injector` that's part of the environment injector hierarchy, which exists outside of the
|
||||
* component tree.
|
||||
*
|
||||
* @see [Types of injector hierarchies](guide/di/hierarchical-dependency-injection#types-of-injector-hierarchies)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class EnvironmentInjector implements Injector {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,8 @@ const globalErrorListeners = new InjectionToken<void>(ngDevMode ? 'GlobalErrorLi
|
|||
*
|
||||
* The listeners added are for the window's 'unhandledrejection' and 'error' events.
|
||||
*
|
||||
* @see [Global error listeners](best-practices/error-handling#global-error-listeners)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function provideBrowserGlobalErrorListeners(): EnvironmentProviders {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ import {PendingTasksInternal} from './pending_tasks';
|
|||
* <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
|
||||
* ```
|
||||
*
|
||||
* @see [Declaring outputs with the @Output decorator](guide/components/outputs#declaring-outputs-with-the-output-decorator)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface EventEmitter<T> extends Subject<T>, OutputRef<T> {
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@ export function withDomHydration(): EnvironmentProviders {
|
|||
/**
|
||||
* Returns a set of providers required to setup support for i18n hydration.
|
||||
* Requires hydration to be enabled separately.
|
||||
* @see [I18N](guide/hydration#i18n)
|
||||
*/
|
||||
export function withI18nSupport(): Provider[] {
|
||||
return [
|
||||
|
|
@ -340,6 +341,7 @@ export function withI18nSupport(): Provider[] {
|
|||
* Returns a set of providers required to setup support for incremental hydration.
|
||||
* Requires hydration to be enabled separately.
|
||||
* Enabling incremental hydration also enables event replay for the entire app.
|
||||
* @see [Incremental Hydration](guide/incremental-hydration#how-do-you-enable-incremental-hydration-in-angular)
|
||||
*/
|
||||
export function withIncrementalHydration(): Provider[] {
|
||||
const providers: Provider[] = [
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ function shouldEnableEventReplay(injector: Injector) {
|
|||
/**
|
||||
* Returns a set of providers required to setup support for event replay.
|
||||
* Requires hydration to be enabled separately.
|
||||
*
|
||||
* @see [Capturing and replaying event](guide/hydration#capturing-and-replaying-events)
|
||||
*
|
||||
*/
|
||||
export function withEventReplay(): Provider[] {
|
||||
const providers: Provider[] = [
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ export function createElementRef(tNode: TNode, lView: LView): ElementRef {
|
|||
* XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
|
||||
* [Security Guide](https://g.co/ng/security).
|
||||
*
|
||||
* @see [Using DOM APIs](guide/components/dom-apis)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
|
||||
|
|
|
|||
|
|
@ -100,6 +100,12 @@ export interface DirectiveDecorator {
|
|||
/**
|
||||
* Directive decorator and metadata.
|
||||
*
|
||||
* @see [Built-in directives](guide/directives)
|
||||
* @see [Including inputs and outputs](guide/directives/directive-composition-api#including-inputs-and-outputs)
|
||||
* @see [Assigning a reference to an Angular directive](guide/templates/variables#assigning-a-reference-to-an-angular-directive)
|
||||
* @see [Referencing component children with queries](guide/components/queries)
|
||||
* @see [Binding to the host element](guide/components/host-elements#binding-to-the-host-element)
|
||||
* @see [Host directive semantics](guide/directives/directive-composition-api#host-directive-semantics)
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
|
|
@ -528,6 +534,11 @@ export interface ComponentDecorator {
|
|||
/**
|
||||
* Supplies configuration metadata for an Angular component.
|
||||
*
|
||||
* @see [Anatomy of a component](guide/components)
|
||||
* @see [ChangeDetectionStrategy](guide/components/advanced-configuration#changedetectionstrategy)
|
||||
* @see [Using the viewProviders array](guide/di/hierarchical-dependency-injection#using-the-viewproviders-array)
|
||||
* @see [Style scoping](guide/components/styling#style-scoping)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Component extends Directive {
|
||||
|
|
@ -716,7 +727,7 @@ export interface PipeDecorator {
|
|||
* to a template. To make it a member of an NgModule,
|
||||
* list it in the `declarations` field of the `NgModule` metadata.
|
||||
*
|
||||
* @see [Style Guide: Pipe Names](style-guide#02-09)
|
||||
* @see [Pipes](/guide/templates/pipes)
|
||||
*
|
||||
*/
|
||||
(obj: Pipe): TypeDecorator;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ export class PendingTasksInternal implements OnDestroy {
|
|||
* taskCleanup();
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @see [PendingTasks for Server Side Rendering (SSR)](guide/zoneless#pendingtasks-for-server-side-rendering-ssr)
|
||||
*
|
||||
* @publicApi 20.0
|
||||
*/
|
||||
export class PendingTasks {
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ export interface AfterRenderOptions {
|
|||
* }
|
||||
* ```
|
||||
*
|
||||
* @see [afterEveryRender and afterNextRender](guide/components/lifecycle#aftereveryrender-and-afternextrender)
|
||||
*
|
||||
* @publicApi 20.0
|
||||
*/
|
||||
export function afterEveryRender<E = never, W = never, M = never>(
|
||||
|
|
@ -309,6 +311,7 @@ export function afterEveryRender(
|
|||
* ```
|
||||
*
|
||||
* @publicApi 20.0
|
||||
* @see [afterEveryRender and afterNextRender](guide/components/lifecycle#aftereveryrender-and-afternextrender)
|
||||
*/
|
||||
export function afterNextRender<E = never, W = never, M = never>(
|
||||
spec: {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ import {assertComponentDef} from './errors';
|
|||
* * `bindings` (optional): Bindings to apply to the root component.
|
||||
* @returns ComponentRef instance that represents a given Component.
|
||||
*
|
||||
* @see [Host view using `ViewContainerRef.createComponent`](guide/components/programmatic-rendering#host-view-using-viewcontainerrefcreatecomponent)
|
||||
* @see [Popup attached to `document.body` with `createComponent` + `hostElement`](guide/components/programmatic-rendering#popup-attached-to-documentbody-with-createcomponent--hostelement)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function createComponent<C>(
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ function getProviderTokenMeasureName<T>(token: any) {
|
|||
* @experimental
|
||||
*
|
||||
* @returns a function that can be invoked to stop sending profiling data.
|
||||
* @see [Profiling with the Chrome DevTools](best-practices/profiling-with-chrome-devtools#recording-a-profile)
|
||||
*/
|
||||
export function enableProfiling() {
|
||||
performanceMarkFeature('Chrome DevTools profiling');
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ function inputBindingUpdate(targetDirectiveIdx: number, publicName: string, valu
|
|||
* bindings: [inputBinding('disabled', isDisabled)]
|
||||
* });
|
||||
* ```
|
||||
* @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation)
|
||||
*/
|
||||
export function inputBinding(publicName: string, value: () => unknown): Binding {
|
||||
// Note: ideally we would use a class here, but it seems like they
|
||||
|
|
@ -149,6 +150,7 @@ export function inputBinding(publicName: string, value: () => unknown): Binding
|
|||
* ],
|
||||
* });
|
||||
* ```
|
||||
* @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation)
|
||||
*/
|
||||
export function outputBinding<T>(eventName: string, listener: (event: T) => unknown): Binding {
|
||||
// Note: ideally we would use a class here, but it seems like they
|
||||
|
|
@ -186,6 +188,7 @@ export function outputBinding<T>(eventName: string, listener: (event: T) => unkn
|
|||
* ],
|
||||
* });
|
||||
* ```
|
||||
* @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation)
|
||||
*/
|
||||
export function twoWayBinding(publicName: string, value: WritableSignal<unknown>): Binding {
|
||||
const input = inputBinding(publicName, value) as BindingInternal;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export interface CreateComputedOptions<T> {
|
|||
|
||||
/**
|
||||
* Create a computed `Signal` which derives a reactive value from an expression.
|
||||
* @see [Computed signals](guide/signals#computed-signals)
|
||||
*/
|
||||
export function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {
|
||||
const getter = createComputed(computation, options?.equal);
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ export interface CreateEffectOptions {
|
|||
* before the next effect run. The cleanup function makes it possible to "cancel" any work that the
|
||||
* previous effect run might have started.
|
||||
*
|
||||
* @see [Effect cleanup functions](guide/signals#effect-cleanup-functions)
|
||||
*
|
||||
* @publicApi 20.0
|
||||
*/
|
||||
export type EffectCleanupFn = () => void;
|
||||
|
|
@ -105,6 +107,8 @@ export type EffectCleanupFn = () => void;
|
|||
/**
|
||||
* A callback passed to the effect function that makes it possible to register cleanup logic.
|
||||
*
|
||||
* @see [Effect cleanup functions](guide/signals#effect-cleanup-functions)
|
||||
*
|
||||
* @publicApi 20.0
|
||||
*/
|
||||
export type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;
|
||||
|
|
@ -125,6 +129,8 @@ export type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;
|
|||
*
|
||||
* `effect()` must be run in injection context, unless the `injector` option is manually specified.
|
||||
*
|
||||
* @see [Effects](guide/signals#effects)
|
||||
*
|
||||
* @publicApi 20.0
|
||||
*/
|
||||
export function effect(
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ export function linkedSignal<D>(
|
|||
* Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.
|
||||
*
|
||||
* @publicApi 20.0
|
||||
* @see [Dependent state with linkedSignal](guide/signals/linked-signal)
|
||||
*/
|
||||
export function linkedSignal<S, D>(options: {
|
||||
source: () => S;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ export interface CreateSignalOptions<T> {
|
|||
|
||||
/**
|
||||
* Create a `Signal` that can be set or updated directly.
|
||||
* @see [Angular Signals](guide/signals)
|
||||
*/
|
||||
export function signal<T>(initialValue: T, options?: CreateSignalOptions<T>): WritableSignal<T> {
|
||||
const [get, set, update] = createSignal(initialValue, options?.equal);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {untracked as untrackedPrimitive} from '../../../primitives/signals';
|
|||
/**
|
||||
* Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
|
||||
* can, optionally, return a value.
|
||||
* @see [Reading without tracking dependencies](guide/signals#reading-without-tracking-dependencies)
|
||||
*/
|
||||
export function untracked<T>(nonReactiveReadsFn: () => T): T {
|
||||
return untrackedPrimitive(nonReactiveReadsFn);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import {DestroyRef} from '../linker/destroy_ref';
|
|||
* `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new
|
||||
* request object becomes available, which could prematurely abort mutations.
|
||||
*
|
||||
* @see [Async reactivity with resources](guide/signals/resource)
|
||||
*
|
||||
* @experimental 19.0
|
||||
*/
|
||||
export function resource<T, R>(
|
||||
|
|
@ -53,6 +55,7 @@ export function resource<T, R>(
|
|||
* request object becomes available, which could prematurely abort mutations.
|
||||
*
|
||||
* @experimental 19.0
|
||||
* @see [Async reactivity with resources](guide/signals/resource)
|
||||
*/
|
||||
export function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined>;
|
||||
export function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined> {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
* ```
|
||||
* @param value Value to be transformed.
|
||||
*
|
||||
* @see [Built-in transformations](guide/components/inputs#built-in-transformations)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function booleanAttribute(value: unknown): boolean {
|
||||
|
|
@ -34,6 +36,7 @@ export function booleanAttribute(value: unknown): boolean {
|
|||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
* @see [Built-in transformations](guide/components/inputs#built-in-transformations)
|
||||
*/
|
||||
export function numberAttribute(value: unknown, fallbackValue = NaN): number {
|
||||
// parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ let ngZoneInstanceId = 0;
|
|||
* }
|
||||
* ```
|
||||
*
|
||||
* @see [Resolving zone pollution](best-practices/zone-pollution#run-tasks-outside-ngzone)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class NgZone {
|
||||
|
|
|
|||
Loading…
Reference in a new issue