guillotinaweb / ngx-schema-form

HTML form generation based on JSON Schema
MIT License
485 stars 173 forks source link

Can't bind to 'schema' since it isn't a known property of 'sf-form' #59

Open suvarna-tammina opened 7 years ago

suvarna-tammina commented 7 years ago

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. error

rgzr commented 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";

suvarna-tammina commented 7 years ago

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?.

fbessou commented 7 years ago

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 { }
suvarna-tammina commented 7 years ago

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.

fbessou commented 7 years ago

Which version of angular2-schema-form are you using ?

suvarna-tammina commented 7 years ago

'angular2-schema-form':^1.0.0-alpha.33

fbessou commented 7 years ago

You don't get any error in your terminal when you build your project ?

suvarna-tammina commented 7 years ago

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 tag in the template i am getting the error. Don't know Somewhere i am missing but this is creating a problem for me.

rgzr commented 7 years ago

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.

suvarna-tammina commented 7 years ago

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?

fbessou commented 7 years ago

Does the demo work for you ? https://github.com/fbessou/angular2-schema-form-demo

sergeik commented 7 years ago

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

suvarna-tammina commented 7 years ago

demo was working perfectly.......but when i am trying to implement in my project then gets an error.

fbessou commented 7 years ago

@suvarna-tammina: What is the project base you are using?

suvarna-tammina commented 7 years ago

Our project is created using angular-cli and it is webpack based. Is that information your were asking?

TheDarkX commented 7 years ago

The demo working fine. But when implement into my project it hits error

Using tag and import path with /src untitled

cyrilzaharchenko commented 7 years ago

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.

Ragularuban commented 7 years ago

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

Iquebal commented 5 years ago

'sf-form' is not a known element getting issues in angular 7 issues

Iquebal commented 5 years ago

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