@angular/platform-browser

  • Version 22.1.0
  • Published
  • 308 kB
  • 1 dependency
  • MIT license

Install

npm i @angular/platform-browser
yarn add @angular/platform-browser
pnpm add @angular/platform-browser

Overview

Angular - library for using Angular in a web browser

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Variables

variable EVENT_MANAGER_PLUGINS

const EVENT_MANAGER_PLUGINS: InjectionToken<EventManagerPlugin[]>;
  • The injection token for plugins of the EventManager service.

    See Also

    • [Extend event handling](guide/templates/event-listeners#extend-event-handling)

variable REMOVE_STYLES_ON_COMPONENT_DESTROY

const REMOVE_STYLES_ON_COMPONENT_DESTROY: InjectionToken<boolean>;
  • A DI token that indicates whether styles of destroyed components should be removed from DOM.

    By default, the value is set to true.

variable VERSION

const VERSION: Version;

Functions

function bootstrapApplication

bootstrapApplication: (
rootComponent: Type<unknown>,
options?: ApplicationConfig,
context?: BootstrapContext
) => Promise<ApplicationRef>;
  • Bootstraps an instance of an Angular application and renders a standalone component as the application's root component. More information about standalone components can be found in [this guide](guide/components).

    The root component passed into this function **must** be a standalone one

    @Component({
    template: 'Hello world!'
    })
    class Root {}
    const appRef: ApplicationRef = await bootstrapApplication(Root);

    You can add the list of providers that should be available in the application injector by specifying the providers field in an object passed as the second argument:

    await bootstrapApplication(Root, {
    providers: [
    {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}
    ]
    });

    The importProvidersFrom helper method can be used to collect all providers from any existing NgModule (and transitively from all NgModules that it imports):

    await bootstrapApplication(Root, {
    providers: [
    importProvidersFrom(SomeNgModule)
    ]
    });

    Note: the bootstrapApplication method doesn't include [Testability](api/core/Testability) by default. You can add [Testability](api/core/Testability) by getting the list of necessary providers using provideProtractorTestingSupport() function and adding them into the providers array, for example:

    import {provideProtractorTestingSupport} from '@angular/platform-browser';
    await bootstrapApplication(Root, {providers: [provideProtractorTestingSupport()]});

    Parameter rootComponent

    A reference to a standalone component that should be rendered.

    Parameter options

    Extra configuration for the bootstrap operation, see ApplicationConfig for additional info.

    Parameter context

    Optional context object that can be used to provide a pre-existing platform injector. This is useful for advanced use-cases, for example, server-side rendering, where the platform is created for each request.

    Returns

    A promise that returns an ApplicationRef instance once resolved.

function createApplication

createApplication: (
options?: ApplicationConfig,
context?: BootstrapContext
) => Promise<ApplicationRef>;
  • Create an instance of an Angular application without bootstrapping any components. This is useful for the situation where one wants to decouple application environment creation (a platform and associated injectors) from rendering components on a screen. Components can be subsequently bootstrapped on the returned ApplicationRef.

    Parameter options

    Extra configuration for the application environment, see ApplicationConfig for additional info.

    Parameter context

    Optional context object that can be used to provide a pre-existing platform injector. This is useful for advanced use-cases, for example, server-side rendering, where the platform is created for each request.

    Returns

    A promise that returns an ApplicationRef instance once resolved.

function disableDebugTools

disableDebugTools: () => void;
  • Disables Angular tools.

function enableDebugTools

enableDebugTools: <T>(ref: ComponentRef<T>) => ComponentRef<T>;
  • Enabled Angular debug tools that are accessible via your browser's developer console.

    Usage:

    1. Open developer console (e.g. in Chrome Ctrl + Shift + j) 1. Type ng. (usually the console will show auto-complete suggestion) 1. Try the change detection profiler ng.profiler.timeChangeDetection() then hit Enter.

function platformBrowser

platformBrowser: (extraProviders?: StaticProvider[]) => PlatformRef;
  • A factory function that returns a PlatformRef instance associated with browser service providers.

function provideClientHydration

provideClientHydration: (
...features: HydrationFeature<HydrationFeatureKind>[]
) => EnvironmentProviders;
  • Sets up providers necessary to enable hydration functionality for the application.

    By default, the function enables the recommended set of features for the optimal performance for most of the applications. It includes the following features:

    * Reconciling DOM hydration. Learn more about it [here](guide/hydration). * [HttpClient](api/common/http/HttpClient) response caching while running on the server and transferring this cache to the client to avoid extra HTTP requests. Learn more about data caching [here](guide/ssr#caching-data-when-using-httpclient). Incremental hydration. [Learn more](guide/incremental-hydration).

    These functions allow you to disable some of the default features or enable new ones:

    * withNoHttpTransferCache to disable HTTP transfer cache * withHttpTransferCacheOptions to configure some HTTP transfer cache options * withI18nSupport to enable hydration support for i18n blocks * withEventReplay to enable support for replaying user events * withNoIncrementalHydration to disable incremental hydration

    Basic example of how you can enable hydration in your application when bootstrapApplication function is used:

    bootstrapApplication(App, {
    providers: [provideClientHydration()]
    });

    Alternatively if you are using NgModules, you would add provideClientHydration to your root app module's provider list.

    @NgModule({
    declarations: [RootCmp],
    bootstrap: [RootCmp],
    providers: [provideClientHydration()],
    })
    export class AppModule {}

    Parameter features

    Optional features to configure additional hydration behaviors.

    Returns

    A set of providers to enable hydration.

    17.0

    See Also

function provideCssVarNamespacing

provideCssVarNamespacing: (namespace?: string) => EnvironmentProviders;
  • Configures the application to use the given namespace for all CSS variables.

    Parameter namespace

    The prefix string to use as a namespace. If not provided, it defaults to the APP_ID. An underscore is appended unconditionally.

function provideProtractorTestingSupport

provideProtractorTestingSupport: (options?: {
usePendingTasksForStability?: boolean;
}) => Provider[];
  • Returns a set of providers required to setup [Testability](api/core/Testability) for an application bootstrapped using the bootstrapApplication function. The set of providers is needed to support testing an application with Protractor (which relies on the Testability APIs to be present).

    Returns

    An array of providers required to setup Testability for an application and make it available for testing using Protractor.

function withEventReplay

withEventReplay: () => HydrationFeature<HydrationFeatureKind.EventReplay>;
  • Enables support for replaying user events (e.g. clicks) that happened on a page before hydration logic has completed. Once an application is hydrated, all captured events are replayed and relevant event listeners are executed.

    Basic example of how you can enable event replay in your application when bootstrapApplication function is used:

    bootstrapApplication(App, {
    providers: [provideClientHydration(withEventReplay())]
    });

    See Also

function withHttpTransferCacheOptions

withHttpTransferCacheOptions: (
options: HttpTransferCacheOptions
) => HydrationFeature<HydrationFeatureKind.HttpTransferCacheOptions>;
  • The function accepts an object, which allows to configure cache parameters, such as which headers should be included (no headers are included by default), whether POST requests should be cached or a callback function to determine if a particular request should be cached.

    See Also

    • [Configuring HTTP transfer cache options](guide/ssr#caching-data-when-using-httpclient)

function withI18nSupport

withI18nSupport: () => HydrationFeature<HydrationFeatureKind.I18nSupport>;
  • Enables support for hydrating i18n blocks.

    20.0

function withIncrementalHydration

withIncrementalHydration: () => HydrationFeature<HydrationFeatureKind.IncrementalHydration>;
  • Enables support for incremental hydration using the hydrate trigger syntax.

    Basic example of how you can enable incremental hydration in your application when the bootstrapApplication function is used:

    bootstrapApplication(App, {
    providers: [provideClientHydration(withIncrementalHydration())]
    });

    20.0

    See Also

    Deprecated

    Since v22.0.0, incremental hydration is enabled by default with provideClientHydration. Intent to remove in v24.

function withNoHttpTransferCache

withNoHttpTransferCache: () => HydrationFeature<HydrationFeatureKind.NoHttpTransferCache>;
  • Disables HTTP transfer cache. Effectively causes HTTP requests to be performed twice: once on the server and other one on the browser.

    See Also

    • [Disabling Caching](guide/ssr#disabling-caching)

function withNoIncrementalHydration

withNoIncrementalHydration: () => HydrationFeature<HydrationFeatureKind.NoIncrementalHydration>;

Classes

class BrowserModule

class BrowserModule {}
  • Exports required infrastructure for all Angular apps. Included by default in all Angular apps created with the CLI new command. Re-exports CommonModule and ApplicationModule, making their exports and providers available to all apps.

constructor

constructor();

    property ɵfac

    static ɵfac: i0.ɵɵFactoryDeclaration<BrowserModule, never>;

      property ɵinj

      static ɵinj: i0.ɵɵInjectorDeclaration<BrowserModule>;

        property ɵmod

        static ɵmod: i0.ɵɵNgModuleDeclaration<BrowserModule, never, never, [any, any]>;

          class By

          class By {}

          method all

          static all: () => Predicate<DebugNode>;
          • Match all nodes.

            ### Example

          method css

          static css: (selector: string) => Predicate<DebugElement>;
          • Match elements by the given CSS selector.

            ### Example

          method directive

          static directive: (type: Type<any>) => Predicate<DebugNode>;
          • Match nodes that have the given directive present.

            ### Example

          class CssVarNamespacer

          class CssVarNamespacer {}
          • A service that can be used to manually namespace CSS variable names at runtime. This is useful when reading or setting CSS variables dynamically in JavaScript that were transformed by the compiler during the build.

            22.1

          property ɵfac

          static ɵfac: i0.ɵɵFactoryDeclaration<CssVarNamespacer, never>;

            property ɵprov

            static ɵprov: i0.ɵɵInjectableDeclaration<CssVarNamespacer>;

              method namespace

              namespace: (name: string) => string;
              • Prepends the namespace prefix to a CSS variable name.

                Parameter name

                The CSS variable name to namespace, including the leading --.

                Returns

                The namespaced CSS variable name, including the leading --. Returns the input unchanged if no namespace is configured.

              class DomSanitizer

              abstract class DomSanitizer implements Sanitizer {}
              • DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing values to be safe to use in the different DOM contexts.

                For example, when binding a URL in an <a [href]="someValue"> hyperlink, someValue will be sanitized so that an attacker cannot inject e.g. a javascript: URL that would execute code on the website.

                In specific situations, it might be necessary to disable sanitization, for example if the application genuinely needs to produce a javascript: style link with a dynamic value in it. Users can bypass security by constructing a value with one of the bypassSecurityTrust... methods, and then binding to that value from the template.

                These situations should be very rare, and extraordinary care must be taken to avoid creating a Cross Site Scripting (XSS) security bug!

                When using bypassSecurityTrust..., make sure to call the method as early as possible and as close as possible to the source of the value, to make it easy to verify no security bug is created by its use.

                It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous code. The sanitizer leaves safe values intact.

                Calling any of the bypassSecurityTrust... APIs disables Angular's built-in sanitization for the value passed in. Carefully check and audit all values and code paths going into this call. Make sure any user data is appropriately escaped for this security context. For more detail, see the [Security Guide](https://g.co/ng/security).

              property ɵfac

              static ɵfac: i0.ɵɵFactoryDeclaration<DomSanitizer, never>;

                property ɵprov

                static ɵprov: i0.ɵɵInjectableDeclaration<DomSanitizer>;

                  method bypassSecurityTrustHtml

                  abstract bypassSecurityTrustHtml: (value: string) => SafeHtml;
                  • Bypass security and trust the given value to be safe HTML. Only use this when the bound HTML is unsafe (e.g. contains <script> tags) and the code should be executed. The sanitizer will leave safe HTML intact, so in most situations this method should not be used.

                    **WARNING:** calling this method with untrusted user data exposes your application to XSS security risks!

                  method bypassSecurityTrustResourceUrl

                  abstract bypassSecurityTrustResourceUrl: (value: string) => SafeResourceUrl;
                  • Bypass security and trust the given value to be a safe resource URL, i.e. a location that may be used to load executable code from, like <script src>, or <iframe src>.

                    **WARNING:** calling this method with untrusted user data exposes your application to XSS security risks!

                  method bypassSecurityTrustScript

                  abstract bypassSecurityTrustScript: (value: string) => SafeScript;
                  • Bypass security and trust the given value to be safe JavaScript.

                    **WARNING:** calling this method with untrusted user data exposes your application to XSS security risks!

                  method bypassSecurityTrustStyle

                  abstract bypassSecurityTrustStyle: (value: string) => SafeStyle;
                  • Bypass security and trust the given value to be safe style value (CSS).

                    **WARNING:** calling this method with untrusted user data exposes your application to XSS security risks!

                  method bypassSecurityTrustUrl

                  abstract bypassSecurityTrustUrl: (value: string) => SafeUrl;
                  • Bypass security and trust the given value to be a safe style URL, i.e. a value that can be used in hyperlinks or <img src>.

                    **WARNING:** calling this method with untrusted user data exposes your application to XSS security risks!

                  method sanitize

                  abstract sanitize: (
                  context: SecurityContext,
                  value: SafeValue | string | null
                  ) => string | null;
                  • Gets a safe value from either a known safe value or a value with unknown safety.

                    If the given value is already a SafeValue, this method returns the unwrapped value. If the security context is HTML and the given value is a plain string, this method sanitizes the string, removing any potentially unsafe content. For any other security context, this method throws an error if provided with a plain string.

                  class EventManager

                  class EventManager {}
                  • An injectable service that provides event management for Angular through a browser plug-in.

                  constructor

                  constructor(plugins: EventManagerPlugin[], _zone: NgZone);
                  • Initializes an instance of the event-manager service.

                  property ɵfac

                  static ɵfac: i0.ɵɵFactoryDeclaration<EventManager, never>;

                    property ɵprov

                    static ɵprov: i0.ɵɵInjectableDeclaration<EventManager>;

                      method addEventListener

                      addEventListener: (
                      element: HTMLElement,
                      eventName: string,
                      handler: Function,
                      options?: ListenerOptions
                      ) => Function;
                      • Registers a handler for a specific element and event.

                        Parameter element

                        The HTML element to receive event notifications.

                        Parameter eventName

                        The name of the event to listen for.

                        Parameter handler

                        A function to call when the notification occurs. Receives the event object as an argument.

                        Parameter options

                        Options that configure how the event listener is bound.

                        Returns

                        A callback function that can be used to remove the handler.

                      method getZone

                      getZone: () => NgZone;
                      • Retrieves the compilation zone in which event listeners are registered.

                      class EventManagerPlugin

                      abstract class EventManagerPlugin {}
                      • The plugin definition for the EventManager class

                        It can be used as a base class to create custom manager plugins, i.e. you can create your own class that extends the EventManagerPlugin one.

                        See Also

                        • [Extend event handling](guide/templates/event-listeners#extend-event-handling)

                      constructor

                      constructor(_doc: any);

                        property manager

                        manager: EventManager;

                          method addEventListener

                          abstract addEventListener: (
                          element: HTMLElement,
                          eventName: string,
                          handler: Function,
                          options?: ListenerOptions
                          ) => Function;
                          • Implement the behaviour for the supported events

                          method supports

                          abstract supports: (eventName: string) => boolean;
                          • Should return true for every event name that should be supported by this plugin

                          class Meta

                          class Meta {}
                          • A service for managing HTML <meta> tags.

                            Properties of the MetaDefinition object match the attributes of the HTML <meta> tag. These tags define document metadata that is important for things like configuring a Content Security Policy, defining browser compatibility and security settings, setting HTTP Headers, defining rich content for social sharing, and Search Engine Optimization (SEO).

                            To identify specific <meta> tags in a document, use an attribute selection string in the format "tag_attribute='value string'". For example, an attrSelector value of "name='description'" matches a tag whose name attribute has the value "description". Selectors are used with the querySelector() Document method, in the format meta[{attrSelector}].

                            See Also

                            • [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)

                            • [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)

                          property ɵfac

                          static ɵfac: i0.ɵɵFactoryDeclaration<Meta, never>;

                            property ɵprov

                            static ɵprov: i0.ɵɵInjectableDeclaration<Meta>;

                              method addTag

                              addTag: (tag: MetaDefinition, forceCreation?: boolean) => HTMLMetaElement | null;
                              • Retrieves or creates a specific <meta> tag element in the current HTML document. In searching for an existing tag, Angular attempts to match the name or property attribute values in the provided tag definition, and verifies that all other attribute values are equal. If an existing element is found, it is returned and is not modified in any way.

                                Parameter tag

                                The definition of a <meta> element to match or create.

                                Parameter forceCreation

                                True to create a new element without checking whether one already exists.

                                Returns

                                The existing element with the same attributes and values if found, the new element if no match is found, or null if the tag parameter is not defined.

                              method addTags

                              addTags: (tags: MetaDefinition[], forceCreation?: boolean) => HTMLMetaElement[];
                              • Retrieves or creates a set of <meta> tag elements in the current HTML document. In searching for an existing tag, Angular attempts to match the name or property attribute values in the provided tag definition, and verifies that all other attribute values are equal.

                                Parameter tags

                                An array of tag definitions to match or create.

                                Parameter forceCreation

                                True to create new elements without checking whether they already exist.

                                Returns

                                The matching elements if found, or the new elements.

                              method getTag

                              getTag: (attrSelector: string) => HTMLMetaElement | null;
                              • Retrieves a <meta> tag element in the current HTML document.

                                Parameter attrSelector

                                The tag attribute and value to match against, in the format "tag_attribute='value string'".

                                Returns

                                The matching element, if any.

                              method getTags

                              getTags: (attrSelector: string) => HTMLMetaElement[];
                              • Retrieves a set of <meta> tag elements in the current HTML document.

                                Parameter attrSelector

                                The tag attribute and value to match against, in the format "tag_attribute='value string'".

                                Returns

                                The matching elements, if any.

                              method removeTag

                              removeTag: (attrSelector: string) => void;
                              • Removes an existing <meta> tag element from the current HTML document.

                                Parameter attrSelector

                                A tag attribute and value to match against, to identify an existing tag. A string in the format "tag_attribute=value string".

                              method removeTagElement

                              removeTagElement: (meta: HTMLMetaElement) => void;
                              • Removes an existing <meta> tag element from the current HTML document.

                                Parameter meta

                                The tag definition to match against to identify an existing tag.

                              method updateTag

                              updateTag: (tag: MetaDefinition, selector?: string) => HTMLMetaElement | null;
                              • Modifies an existing <meta> tag element in the current HTML document.

                                Parameter tag

                                The tag description with which to replace the existing tag content.

                                Parameter selector

                                A tag attribute and value to match against, to identify an existing tag. A string in the format "tag_attribute=value string". If not supplied, matches a tag with the same name or property attribute value as the replacement tag. The modified element.

                              class ɵBrowserDomAdapter

                              class BrowserDomAdapter extends _DomAdapter {}
                              • A DomAdapter powered by full browser DOM APIs.

                                Tread carefully! Interacting with the DOM directly is dangerous and can introduce XSS risks.

                              property supportsDOMEvents

                              readonly supportsDOMEvents: boolean;

                                method createElement

                                createElement: (tagName: string, doc?: Document) => HTMLElement;

                                  method createHtmlDocument

                                  createHtmlDocument: () => Document;

                                    method dispatchEvent

                                    dispatchEvent: (el: Node, evt: any) => void;

                                      method getBaseHref

                                      getBaseHref: (doc: Document) => string | null;

                                        method getCookie

                                        getCookie: (name: string) => string | null;

                                          method getDefaultDocument

                                          getDefaultDocument: () => Document;

                                            method getGlobalEventTarget

                                            getGlobalEventTarget: (doc: Document, target: string) => EventTarget | null;
                                            • Deprecated

                                              No longer being used in Ivy code. To be removed in version 14.

                                            method getUserAgent

                                            getUserAgent: () => string;

                                              method isElementNode

                                              isElementNode: (node: Node) => boolean;

                                                method isShadowRoot

                                                isShadowRoot: (node: any) => boolean;

                                                  method makeCurrent

                                                  static makeCurrent: () => void;

                                                    method onAndCancel

                                                    onAndCancel: (el: Node, evt: any, listener: any, options: any) => Function;

                                                      method remove

                                                      remove: (node: Node) => void;

                                                        method resetBaseElement

                                                        resetBaseElement: () => void;

                                                          class ɵBrowserGetTestability

                                                          class BrowserGetTestability implements GetTestability {}

                                                            method addToWindow

                                                            addToWindow: (registry: TestabilityRegistry) => void;

                                                              method findTestabilityInTree

                                                              findTestabilityInTree: (
                                                              registry: TestabilityRegistry,
                                                              elem: any,
                                                              findInAncestors: boolean
                                                              ) => Testability | null;

                                                                class ɵDomEventsPlugin

                                                                class DomEventsPlugin extends EventManagerPlugin {}

                                                                  constructor

                                                                  constructor(doc: any);

                                                                    property ɵfac

                                                                    static ɵfac: i0.ɵɵFactoryDeclaration<DomEventsPlugin, never>;

                                                                      property ɵprov

                                                                      static ɵprov: i0.ɵɵInjectableDeclaration<DomEventsPlugin>;

                                                                        method addEventListener

                                                                        addEventListener: (
                                                                        element: HTMLElement,
                                                                        eventName: string,
                                                                        handler: Function,
                                                                        options?: ListenerOptions
                                                                        ) => Function;

                                                                          method removeEventListener

                                                                          removeEventListener: (
                                                                          target: any,
                                                                          eventName: string,
                                                                          callback: Function,
                                                                          options?: ListenerOptions
                                                                          ) => void;

                                                                            method supports

                                                                            supports: (eventName: string) => boolean;

                                                                              class ɵDomRendererFactory2

                                                                              class DomRendererFactory2 implements RendererFactory2, OnDestroy {}

                                                                                constructor

                                                                                constructor(
                                                                                eventManager: EventManager,
                                                                                sharedStylesHost: SharedStylesHost,
                                                                                appId: string,
                                                                                removeStylesOnCompDestroy: boolean,
                                                                                doc: Document,
                                                                                ngZone: NgZone,
                                                                                nonce?: string,
                                                                                tracingService?: any,
                                                                                cssVarNamespace?: string
                                                                                );

                                                                                  property ngZone

                                                                                  readonly ngZone: NgZone;

                                                                                    property ɵfac

                                                                                    static ɵfac: i0.ɵɵFactoryDeclaration<
                                                                                    DomRendererFactory2,
                                                                                    [
                                                                                    null,
                                                                                    null,
                                                                                    null,
                                                                                    null,
                                                                                    null,
                                                                                    null,
                                                                                    null,
                                                                                    { optional: true },
                                                                                    { optional: true }
                                                                                    ]
                                                                                    >;

                                                                                      property ɵprov

                                                                                      static ɵprov: i0.ɵɵInjectableDeclaration<DomRendererFactory2>;

                                                                                        method componentReplaced

                                                                                        protected componentReplaced: (componentId: string) => void;
                                                                                        • Used during HMR to clear any cached data about a component.

                                                                                          Parameter componentId

                                                                                          ID of the component that is being replaced.

                                                                                        method createRenderer

                                                                                        createRenderer: (element: any, type: RendererType2 | null) => Renderer2;

                                                                                          method ngOnDestroy

                                                                                          ngOnDestroy: () => void;

                                                                                            class ɵDomSanitizerImpl

                                                                                            class DomSanitizerImpl extends DomSanitizer {}

                                                                                              property ɵfac

                                                                                              static ɵfac: i0.ɵɵFactoryDeclaration<DomSanitizerImpl, never>;

                                                                                                property ɵprov

                                                                                                static ɵprov: i0.ɵɵInjectableDeclaration<DomSanitizerImpl>;

                                                                                                  method bypassSecurityTrustHtml

                                                                                                  bypassSecurityTrustHtml: (value: string) => SafeHtml;

                                                                                                    method bypassSecurityTrustResourceUrl

                                                                                                    bypassSecurityTrustResourceUrl: (value: string) => SafeResourceUrl;

                                                                                                      method bypassSecurityTrustScript

                                                                                                      bypassSecurityTrustScript: (value: string) => SafeScript;

                                                                                                        method bypassSecurityTrustStyle

                                                                                                        bypassSecurityTrustStyle: (value: string) => SafeStyle;

                                                                                                          method bypassSecurityTrustUrl

                                                                                                          bypassSecurityTrustUrl: (value: string) => SafeUrl;

                                                                                                            method sanitize

                                                                                                            sanitize: (
                                                                                                            ctx: SecurityContext,
                                                                                                            value: SafeValue | string | null
                                                                                                            ) => string | null;

                                                                                                              class ɵKeyEventsPlugin

                                                                                                              class KeyEventsPlugin extends EventManagerPlugin {}
                                                                                                              • A browser plug-in that provides support for handling of key events in Angular.

                                                                                                              constructor

                                                                                                              constructor(doc: any);
                                                                                                              • Initializes an instance of the browser plug-in.

                                                                                                                Parameter doc

                                                                                                                The document in which key events will be detected.

                                                                                                              property ɵfac

                                                                                                              static ɵfac: i0.ɵɵFactoryDeclaration<KeyEventsPlugin, never>;

                                                                                                                property ɵprov

                                                                                                                static ɵprov: i0.ɵɵInjectableDeclaration<KeyEventsPlugin>;

                                                                                                                  method addEventListener

                                                                                                                  addEventListener: (
                                                                                                                  element: HTMLElement,
                                                                                                                  eventName: string,
                                                                                                                  handler: Function,
                                                                                                                  options?: ListenerOptions
                                                                                                                  ) => Function;
                                                                                                                  • Registers a handler for a specific element and key event.

                                                                                                                    Parameter element

                                                                                                                    The HTML element to receive event notifications.

                                                                                                                    Parameter eventName

                                                                                                                    The name of the key event to listen for.

                                                                                                                    Parameter handler

                                                                                                                    A function to call when the notification occurs. Receives the event object as an argument.

                                                                                                                    Returns

                                                                                                                    The key event that was registered.

                                                                                                                  method eventCallback

                                                                                                                  static eventCallback: (
                                                                                                                  fullKey: string,
                                                                                                                  handler: Function,
                                                                                                                  zone: NgZone
                                                                                                                  ) => Function;
                                                                                                                  • Configures a handler callback for a key event.

                                                                                                                    Parameter fullKey

                                                                                                                    The event name that combines all simultaneous keystrokes.

                                                                                                                    Parameter handler

                                                                                                                    The function that responds to the key event.

                                                                                                                    Parameter zone

                                                                                                                    The zone in which the event occurred.

                                                                                                                    Returns

                                                                                                                    A callback function.

                                                                                                                  method matchEventFullKeyCode

                                                                                                                  static matchEventFullKeyCode: (
                                                                                                                  event: KeyboardEvent,
                                                                                                                  fullKeyCode: string
                                                                                                                  ) => boolean;
                                                                                                                  • Determines whether the actual keys pressed match the configured key code string. The fullKeyCode event is normalized in the parseEventName method when the event is attached to the DOM during the addEventListener call. This is unseen by the end user and is normalized for internal consistency and parsing.

                                                                                                                    Parameter event

                                                                                                                    The keyboard event.

                                                                                                                    Parameter fullKeyCode

                                                                                                                    The normalized user defined expected key event string

                                                                                                                    Returns

                                                                                                                    boolean.

                                                                                                                  method parseEventName

                                                                                                                  static parseEventName: (
                                                                                                                  eventName: string
                                                                                                                  ) => { fullKey: string; domEventName: string } | null;
                                                                                                                  • Parses the user provided full keyboard event definition and normalizes it for later internal use. It ensures the string is all lowercase, converts special characters to a standard spelling, and orders all the values consistently.

                                                                                                                    Parameter eventName

                                                                                                                    The name of the key event to listen for.

                                                                                                                    Returns

                                                                                                                    an object with the full, normalized string, and the dom event name or null in the case when the event doesn't match a keyboard event.

                                                                                                                  method supports

                                                                                                                  supports: (eventName: string) => boolean;
                                                                                                                  • Reports whether a named key event is supported.

                                                                                                                    Parameter eventName

                                                                                                                    The event name to query. True if the named key event is supported.

                                                                                                                  class ɵSharedStylesHost

                                                                                                                  class SharedStylesHost implements _SharedStylesHost, OnDestroy {}

                                                                                                                    constructor

                                                                                                                    constructor(doc: Document, appId: string, nonce?: string, platformId?: {});

                                                                                                                      property ɵfac

                                                                                                                      static ɵfac: i0.ɵɵFactoryDeclaration<
                                                                                                                      SharedStylesHost,
                                                                                                                      [null, null, { optional: true }, null]
                                                                                                                      >;

                                                                                                                        property ɵprov

                                                                                                                        static ɵprov: i0.ɵɵInjectableDeclaration<SharedStylesHost>;

                                                                                                                          method addHost

                                                                                                                          addHost: (hostNode: Node) => void;

                                                                                                                            method addStyles

                                                                                                                            addStyles: (styles: string[], urls?: string[]) => void;

                                                                                                                              method addUsage

                                                                                                                              protected addUsage: <T extends HTMLElement>(
                                                                                                                              value: string,
                                                                                                                              usages: Map<string, UsageRecord<T>>,
                                                                                                                              creator: (value: string, doc: Document) => T
                                                                                                                              ) => void;

                                                                                                                                method ngOnDestroy

                                                                                                                                ngOnDestroy: () => void;

                                                                                                                                  method removeHost

                                                                                                                                  removeHost: (hostNode: Node) => void;

                                                                                                                                    method removeStyles

                                                                                                                                    removeStyles: (styles: string[], urls?: string[]) => void;
                                                                                                                                    • Removes embedded styles from the DOM that were added as HTML style elements.

                                                                                                                                      Parameter styles

                                                                                                                                      An array of style content strings.

                                                                                                                                    method removeUsage

                                                                                                                                    protected removeUsage: <T extends HTMLElement>(
                                                                                                                                    value: string,
                                                                                                                                    usages: Map<string, UsageRecord<T>>
                                                                                                                                    ) => void;

                                                                                                                                      class Title

                                                                                                                                      class Title {}
                                                                                                                                      • A service that can be used to get and set the title of a current HTML document.

                                                                                                                                        Since an Angular application can't be bootstrapped on the entire HTML document (<html> tag) it is not possible to bind to the text property of the HTMLTitleElement elements (representing the <title> tag). Instead, this service can be used to set and get the current title value.

                                                                                                                                      constructor

                                                                                                                                      constructor(_doc: any);

                                                                                                                                        property ɵfac

                                                                                                                                        static ɵfac: i0.ɵɵFactoryDeclaration<Title, never>;

                                                                                                                                          property ɵprov

                                                                                                                                          static ɵprov: i0.ɵɵInjectableDeclaration<Title>;

                                                                                                                                            method getTitle

                                                                                                                                            getTitle: () => string;
                                                                                                                                            • Get the title of the current HTML document.

                                                                                                                                            method setTitle

                                                                                                                                            setTitle: (newTitle: string) => void;
                                                                                                                                            • Set the title of the current HTML document.

                                                                                                                                              Parameter newTitle

                                                                                                                                            Interfaces

                                                                                                                                            interface BootstrapContext

                                                                                                                                            interface BootstrapContext {}
                                                                                                                                            • A context object that can be passed to bootstrapApplication to provide a pre-existing platform injector.

                                                                                                                                            property platformRef

                                                                                                                                            platformRef: PlatformRef;
                                                                                                                                            • A reference to a platform.

                                                                                                                                            interface HydrationFeature

                                                                                                                                            interface HydrationFeature<FeatureKind extends HydrationFeatureKind> {}
                                                                                                                                            • Helper type to represent a Hydration feature.

                                                                                                                                            property ɵkind

                                                                                                                                            ɵkind: FeatureKind;

                                                                                                                                              property ɵproviders

                                                                                                                                              ɵproviders: Provider[];

                                                                                                                                                interface SafeHtml

                                                                                                                                                interface SafeHtml extends SafeValue {}
                                                                                                                                                • Marker interface for a value that's safe to use as HTML.

                                                                                                                                                interface SafeResourceUrl

                                                                                                                                                interface SafeResourceUrl extends SafeValue {}
                                                                                                                                                • Marker interface for a value that's safe to use as a URL to load executable code from.

                                                                                                                                                interface SafeScript

                                                                                                                                                interface SafeScript extends SafeValue {}
                                                                                                                                                • Marker interface for a value that's safe to use as JavaScript.

                                                                                                                                                interface SafeStyle

                                                                                                                                                interface SafeStyle extends SafeValue {}
                                                                                                                                                • Marker interface for a value that's safe to use as style (CSS).

                                                                                                                                                interface SafeUrl

                                                                                                                                                interface SafeUrl extends SafeValue {}
                                                                                                                                                • Marker interface for a value that's safe to use as a URL linking to a document.

                                                                                                                                                interface SafeValue

                                                                                                                                                interface SafeValue {}
                                                                                                                                                • Marker interface for a value that's safe to use in a particular context.

                                                                                                                                                Enums

                                                                                                                                                enum HydrationFeatureKind

                                                                                                                                                enum HydrationFeatureKind {
                                                                                                                                                NoHttpTransferCache = 0,
                                                                                                                                                HttpTransferCacheOptions = 1,
                                                                                                                                                I18nSupport = 2,
                                                                                                                                                EventReplay = 3,
                                                                                                                                                IncrementalHydration = 4,
                                                                                                                                                NoIncrementalHydration = 5,
                                                                                                                                                }
                                                                                                                                                • The list of features as an enum to uniquely type each HydrationFeature.

                                                                                                                                                  See Also

                                                                                                                                                member EventReplay

                                                                                                                                                EventReplay = 3

                                                                                                                                                  member HttpTransferCacheOptions

                                                                                                                                                  HttpTransferCacheOptions = 1

                                                                                                                                                    member I18nSupport

                                                                                                                                                    I18nSupport = 2

                                                                                                                                                      member IncrementalHydration

                                                                                                                                                      IncrementalHydration = 4

                                                                                                                                                        member NoHttpTransferCache

                                                                                                                                                        NoHttpTransferCache = 0

                                                                                                                                                          member NoIncrementalHydration

                                                                                                                                                          NoIncrementalHydration = 5

                                                                                                                                                            enum ɵRuntimeErrorCode

                                                                                                                                                            const enum ɵRuntimeErrorCode {
                                                                                                                                                            UNSUPPORTED_ZONEJS_INSTANCE = -5000,
                                                                                                                                                            HYDRATION_CONFLICTING_FEATURES = 5001,
                                                                                                                                                            BROWSER_MODULE_ALREADY_LOADED = 5100,
                                                                                                                                                            NO_PLUGIN_FOR_EVENT = -5101,
                                                                                                                                                            UNSUPPORTED_EVENT_TARGET = -5102,
                                                                                                                                                            TESTABILITY_NOT_FOUND = 5103,
                                                                                                                                                            ROOT_NODE_NOT_FOUND = -5104,
                                                                                                                                                            UNEXPECTED_SYNTHETIC_PROPERTY = 5105,
                                                                                                                                                            SANITIZATION_UNSAFE_SCRIPT = 5200,
                                                                                                                                                            SANITIZATION_UNSAFE_RESOURCE_URL = -5201,
                                                                                                                                                            SANITIZATION_UNEXPECTED_CTX = 5202,
                                                                                                                                                            ANIMATION_RENDERER_ASYNC_LOADING_FAILURE = 5300,
                                                                                                                                                            }
                                                                                                                                                            • The list of error codes used in runtime code of the platform-browser package. Reserved error code range: 5000-5500.

                                                                                                                                                            member ANIMATION_RENDERER_ASYNC_LOADING_FAILURE

                                                                                                                                                            ANIMATION_RENDERER_ASYNC_LOADING_FAILURE = 5300

                                                                                                                                                              member BROWSER_MODULE_ALREADY_LOADED

                                                                                                                                                              BROWSER_MODULE_ALREADY_LOADED = 5100

                                                                                                                                                                member HYDRATION_CONFLICTING_FEATURES

                                                                                                                                                                HYDRATION_CONFLICTING_FEATURES = 5001

                                                                                                                                                                  member NO_PLUGIN_FOR_EVENT

                                                                                                                                                                  NO_PLUGIN_FOR_EVENT = -5101

                                                                                                                                                                    member ROOT_NODE_NOT_FOUND

                                                                                                                                                                    ROOT_NODE_NOT_FOUND = -5104

                                                                                                                                                                      member SANITIZATION_UNEXPECTED_CTX

                                                                                                                                                                      SANITIZATION_UNEXPECTED_CTX = 5202

                                                                                                                                                                        member SANITIZATION_UNSAFE_RESOURCE_URL

                                                                                                                                                                        SANITIZATION_UNSAFE_RESOURCE_URL = -5201

                                                                                                                                                                          member SANITIZATION_UNSAFE_SCRIPT

                                                                                                                                                                          SANITIZATION_UNSAFE_SCRIPT = 5200

                                                                                                                                                                            member TESTABILITY_NOT_FOUND

                                                                                                                                                                            TESTABILITY_NOT_FOUND = 5103

                                                                                                                                                                              member UNEXPECTED_SYNTHETIC_PROPERTY

                                                                                                                                                                              UNEXPECTED_SYNTHETIC_PROPERTY = 5105

                                                                                                                                                                                member UNSUPPORTED_EVENT_TARGET

                                                                                                                                                                                UNSUPPORTED_EVENT_TARGET = -5102

                                                                                                                                                                                  member UNSUPPORTED_ZONEJS_INSTANCE

                                                                                                                                                                                  UNSUPPORTED_ZONEJS_INSTANCE = -5000

                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                    type MetaDefinition

                                                                                                                                                                                    type MetaDefinition = {
                                                                                                                                                                                    charset?: string;
                                                                                                                                                                                    content?: string;
                                                                                                                                                                                    httpEquiv?: string;
                                                                                                                                                                                    id?: string;
                                                                                                                                                                                    itemprop?: string;
                                                                                                                                                                                    name?: string;
                                                                                                                                                                                    property?: string;
                                                                                                                                                                                    scheme?: string;
                                                                                                                                                                                    url?: string;
                                                                                                                                                                                    } & {
                                                                                                                                                                                    [prop: string]: string;
                                                                                                                                                                                    };
                                                                                                                                                                                    • Represents the attributes of an HTML <meta> element. The element itself is represented by the internal HTMLMetaElement.

                                                                                                                                                                                      See Also

                                                                                                                                                                                      • [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)

                                                                                                                                                                                      • Meta

                                                                                                                                                                                    Package Files (2)

                                                                                                                                                                                    Dependencies (1)

                                                                                                                                                                                    Dev Dependencies (0)

                                                                                                                                                                                    No dev dependencies.

                                                                                                                                                                                    Peer Dependencies (3)

                                                                                                                                                                                    Badge

                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@angular/platform-browser.

                                                                                                                                                                                    • Markdown
                                                                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@angular/platform-browser)
                                                                                                                                                                                    • HTML
                                                                                                                                                                                      <a href="https://www.jsdocs.io/package/@angular/platform-browser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>