Angular 4 次重新验证 - 意外标记 <

Angular 4 recaptcha - unexpected token <

我是 Angular 4 的新手,我的任务是实施 reCAPTCHA。我正在按照 https://www.npmjs.com/package/ng-recaptcha 上的示例进行操作。

我在 app.module.ts 中添加了以下内容:

import { RecaptchaModule } from 'ng-recaptcha';
import { RecaptchaFormsModule } from 'ng-recaptcha/forms';

在 'imports' 下的@NgModule 中,我添加了这个:

RecaptchaModule.forRoot(),
RecaptchaFormsModule

当我 运行 应用程序时,我在 Chrome 中收到此错误:"index.debug.html:33 Error: Unexpected token <"

我错过了什么?我正在开发 Visual Studio 2017.

如果你在 visual studio 中使用这意味着你在你的 system.config.js 文件中使用 .net + angular 项目使用这个

// SystemJS config file
 (function () {
 System.config({
paths: {
  'npm:': '/node_modules/',
},
map: {
  'ng-recaptcha': 'npm:ng-recaptcha',
},
packages: {
  'ng-recaptcha': { main: './index.js' },
},
 });
})();