Open suvarna-tammina opened 7 years ago
Try to import with /src
appended to your import path.
import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from "angular2-schema-form/src";
instead of:
import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from "angular2-schema-form";
Thanks for the reply. I have tried importing with /src appended to the path import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry} from "angular2-schema-form/src" but still i am getting the same error. I have one question like to run this angular2-schema-form is thier any neccessary that i should have AOT complier in my project?.
The above configuration should work and does not need AOT compilation. Have you added the SchemaFormModule to the imports
section of your app.module.ts
(or equivalent) ?
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {
DefaultWidgetRegistry,
SchemaFormModule,
WidgetRegistry
} from 'angular2-schema-form/src';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
SchemaFormModule
],
providers: [{provide: WidgetRegistry, useClass: DefaultWidgetRegistry}],
bootstrap: [AppComponent]
})
export class AppModule { }
ya i have added all those in app.module.ts. In my component i have added example json schema then after in html template when i am trying to add sf-form tag like this <sf-form [schema]="mySchema" >. I am getting issue.
Which version of angular2-schema-form are you using ?
'angular2-schema-form':^1.0.0-alpha.33
You don't get any error in your terminal when you build your project ?
No. I am not getting any errors in the terminal while building the project. The only error i am getting is when try to keep the
This happened to me when not using /src
import path since i use webpack.
Is app.module.ts
the only module on your project? Maybe you have to do the imports in the module where you are using the form.
I have different modules in my project not only app.module.ts. As you suggested i have imported SchemaFormModule with /src appended to the path to the imports in app.module.ts then the cannot find module error gone. secondly, I even added the SchemaFormModule in the imports of sub module in my project also. Please suggest me how to make sf-form tag to work?
Does the demo work for you ? https://github.com/fbessou/angular2-schema-form-demo
Same error. I use https://github.com/AngularClass/angular2-webpack-starter/ as base for project.
Demo https://github.com/fbessou/angular2-schema-form-demo works well
demo was working perfectly.......but when i am trying to implement in my project then gets an error.
@suvarna-tammina: What is the project base you are using?
Our project is created using angular-cli and it is webpack based. Is that information your were asking?
The demo working fine. But when implement into my project it hits error
Using
I had the same issue yesterday. I managed to get it working by importing the module from 'src' like this:
import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from 'angular2-schema-form/src';
Another thing is that it should be imported to the module where it will be used, not just in the root module.
And I've noticed several console.log
messages coming from this project. Would be great if they will be removed.
Guys, in the html instead of
<sf-form [schema]="mySchema" [model]="myModel"></sf-form>
Use
<schema-form [schema]="mySchema" [model]="myModel"></schema-form>
It solves the problem
'sf-form' is not a known element getting issues in angular 7
Guys, in the html instead of
<sf-form [schema]="mySchema" [model]="myModel"></sf-form>
Use<schema-form [schema]="mySchema" [model]="myModel"></schema-form>
It solves the problem
Not working
Can you please help me why i am getting issue. By seeing your previous closed issue i have tried to replace schema-form by sf-form in my template but still i am facing problem.