javascriptnode.jsangularnpmangular-schema-form

Import schema-form on the app.module


I'm trying to use the angular-schema-form on an angular project, but I am unable to import it on my app.module.ts. This is my 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 { }

However, when I try to run the ng serve it complies correctly, but the browser displays an error saying the schemaForm is undefined: Uncaught Error: Unexpected value 'undefined' imported by the module 'AppModule'

I have installed the dependency correctly using npm-install, but I am not able to generate a single form. Reading the official documentation it says:

load the schemaForm module in your module definition

And it shows an example of how to import it using: angular.module('myModule', ['schemaForm']). The problem is that I'm not starting my module using angular.module, but using the @NgModule bootstrapping method showed on code above. This project was created from scratch using the angular CLI command ng new project

Could someone guide me in the right direction on how to import and use the angular-schema-form? Thank you.


Solution

  • This package is angularjs package. It is not built for angular. Please find some other package for schema form which os built for angular. Check this link for your reference