Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mtycholaz opened this issue Jan 18, 2025 · 0 comments
Open

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

mtycholaz opened this issue Jan 18, 2025 · 0 comments

Comments

@mtycholaz
Copy link

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
        })
    ]
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant