在app.module上导入模式表单

我正在尝试在angular项目上使用angular度模式表单 ,但我无法将其导入到我的app.module.ts中。 这是我的configuration:

app.module.ts

import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; import { schemaForm } from 'angular-schema-form'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, schemaForm ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } 

但是,当我尝试运行ng serve它正确地符合,但是浏览器显示一个错误,指出schemaForm未定义: Uncaught Error: Unexpected value 'undefined' imported by the module 'AppModule'

我已经使用npm-install正确安装了依赖项,但我无法生成单个窗体。 阅读正式文件说:

在您的模块定义中加载schemaForm模块

它展示了如何使用angular.module('myModule', ['schemaForm'])来导入它的例子。 问题是我没有启动我的模块使用angular.module ,但使用上面的代码中显示的@NgModule自引导方法。 这个项目是从头开始使用angularCLI命令ng new project

有人能指导我如何导入和使用angular度模式forms的正确方向吗? 谢谢。

这个包是angularjs包。 它不是为angular度而build造的。 请find一些其他的模式forms的包,为angular度build立的操作系统。 检查这个链接供您参考

要实际回答如何使用Angular的Angular Schema Form的问题,当它仍然只适用于AngularJS时,您将需要使用ngUpgrade库。

ASF库将升级以支持Angular,但这是一个耗时的过程,可能需要很长时间,除非有更多的人协助迁移项目。