我试图在一个角度的项目上使用角度图式,但是我无法在我的app.module.ts上导入它。这是我的配置:
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正确地安装了依赖项,但是我无法生成一个表单。它说,阅读官方文件:
在模块定义中加载schemaForm模块
并展示了如何使用:angular.module('myModule', ['schemaForm'])导入它的示例。问题是,我不是使用angular.module启动模块,而是使用上面代码中显示的@NgModule引导方法。该项目是使用角CLI命令ng new project从头创建的。
有人能指点我如何导入和使用角度图式吗?谢谢。
https://stackoverflow.com/questions/45041020
复制相似问题