Reputation: 1121
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.
Upvotes: 1
Views: 596
Reputation: 701
To actually answer the question of how to use Angular Schema Form with Angular when it is still only available for AngularJS you would need to use the ngUpgrade library.
The ASF library will be upgraded to support Angular, but it is a time consuming process and may take a long time unless more people assist in the migration project.
Upvotes: 0
Reputation: 2350
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
Upvotes: 1