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

Unclear example #5

Closed
loqtor opened this issue Dec 1, 2016 · 3 comments
Closed

Unclear example #5

loqtor opened this issue Dec 1, 2016 · 3 comments

Comments

@loqtor
Copy link

loqtor commented Dec 1, 2016

Hi,

The module looks interesting. But when looking at the instructions is not actually clear how to set it up.

See below:

import { RecaptchaModule } from 'ng2-recaptcha';
import { BrowserModule }  from '@angular/platform-browser';

@NgModule({
  bootstrap: [MyApp],
  declarations: [MyApp],
  imports: [
    BrowserModule,
    RecaptchaModule.forRoot(), // Keep in mind the "forRoot"-magic nuances!
  ],
})
export class MyAppModule { }

There you bootstrap and declare MyApp which is never imported in this module.
(By the way, forRoot did not do it for me. I get Property 'forRoot' does not exist on type 'typeof ReCaptchaModule' error. I can raise a separate issue with more information if that'd help).

And then here:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<recaptcha (resolved)="resolved($event)" siteKey="YOUR_SITE_KEY"></recaptcha>`,
}) export class MyApp {
    resolved(captchaResponse: string) {
        console.log(`Resolved captcha with response ${captchaResponse}:`);
    }
}

platformBrowserDynamic().bootstrapModule(MyAppModule);

You declare a new component and then export MyApp class. But at the end of this example you bootstrap your AppModule which is never imported in the example.

Can you please check on that? I've been trying to use it and I'm not sure what I'm missing.
So if you can have the instructions corrected, that'd be awesome.

Thanks.
Cheers!

@DethAriel
Copy link
Owner

What version of Angular / TypeScript are you using?

@DethAriel
Copy link
Owner

On the forRoot issue - could you please open a separate bug? Please, include all relevant information (Angular version, TS version, webpack/systemjs, ...)

@loqtor
Copy link
Author

loqtor commented Dec 5, 2016

Thanks. That's much clearer. 👍
Cheers!

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

2 participants