Skip to content

Add support for standalone provider function for angular 18/19 #75

Open
@mtycholaz

Description

@mtycholaz

Angular recommends moving away from bootstrapModule and instead using bootstrapComponent. This means that the forRoot and forChild pattern will be obsolete. Here is the simple hack/wrapper function that I came up with while migrating my application to ng 18.

Please consider officially adding a provider function. You may use the code below for inspiration.

export const provideFingerprintjsPro = (clientOptions: FpjsClientOptions) => {
    const FPJS_PROVIDERS = FingerprintjsProAngularModule.forRoot(clientOptions).providers as (
        | Provider
        | EnvironmentProviders
    )[];

    return FPJS_PROVIDERS;
};

Example usage

bootstrapApplication(AppComponent, {
    providers: [
        provideFingerprintjsPro({
            // config goes here
        })
    ]
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions