question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in console, Template parse errors

See original GitHub issue

HI, I’m using anular-cli for this project.

  • Typescript version is 2.0.2
  • Angular 2.0.0
  • ng2-recaptcha 1.3.2

I’ve installed the typing using the following command

npm install @types/grecaptcha --save-dev

My root app module looks like this

import { BrowserModule } from '@angular/platform-browser';
import { NgModule,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { RecaptchaModule } from 'ng2-recaptcha';
import { routes } from './app-routing.module';
import { AppComponent } from './app.component';
import { UserModule } from './user/user.module';
import { SharedModule } from './shared/shared.module';
import { ToasterModule, ToasterService } from 'angular2-toaster/angular2-toaster';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    RecaptchaModule.forRoot(),
    ToasterModule,
    RouterModule.forRoot(routes, { useHash: true }),
    SharedModule.forRoot(),
    UserModule
  ],
  providers: [ToasterService],
  bootstrap: [AppComponent],
  exports: [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }

After importing the module, in another module, UserModule (which is imported here) I’m using the <recaptcha> element.

Thats when I’m getting this error in browser console.

zone.js:355Unhandled Promise rejection: Template parse errors: ‘recaptcha’ is not a known element:

If ‘recaptcha’ is an Angular component, then verify that it is part of this module.

If ‘recaptcha’ is a Web Component then add “CUSTOM_ELEMENTS_SCHEMA” to the ‘@NgModule.schema’ of this component to suppress this message.

After first time getting this message I added CUSTOM_ELEMENTS_SCHEMA in my root module as seen above, even after that I’m getting the same error.

Where I’m going wrong?

Thanks…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
DethArielcommented, Oct 11, 2016

There are two ways of fixing that:

  1. Add RecaptchaModule to the imports section of your UserModule
  2. Add RecaptchaModule to the imports section of your SharedModule (given that you import SharedModule inside UserModule)

In both cases you should still leave the RecaptchaModule.forRoot() import in your AppModule.

Please, let me know if that resolves the issue that you see

0reactions
nitishatambicommented, Mar 17, 2018

I used this, but getting error in re-captcha tag in html page

image please help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: Template parse errors: in angular8
When I run my angular application following error appear in the console. Uncaught Error: Template parse errors: Can't bind to 'ngModel' ...
Read more >
Template parse errors: : 'xxxComponent' is not a known element
✓ Solved Angular Uncaught Error : Template parse errors : : 'xxxComponent' is not a known element: · Comments.
Read more >
Template parse errors - Angular - CodeDocu.com
Angular Uncaught Error Template parse errors ArticleComponent is not known element message when starting the application remains with ...
Read more >
Catch Angular template errors like a pro or how I create ...
While stackblitz catches all template parser errors i have to open DevTools Console to catch all other runtime errors. And even i can...
Read more >
Parsing error in Templater need help fixing - Obsidian Forum
@Saorsa Please copy and paste the Template file contents you are using with Templater. You must have written some code snippet. That is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found