ngx-schema-form icon indicating copy to clipboard operation
ngx-schema-form copied to clipboard

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

Open suvarna-tammina opened this issue 8 years ago • 20 comments

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

suvarna-tammina avatar Feb 01 '17 11:02 suvarna-tammina

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

rgzr avatar Feb 01 '17 13:02 rgzr

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

suvarna-tammina avatar Feb 02 '17 04:02 suvarna-tammina

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 { }

fbessou avatar Feb 02 '17 07:02 fbessou

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.

suvarna-tammina avatar Feb 02 '17 07:02 suvarna-tammina

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

fbessou avatar Feb 02 '17 07:02 fbessou

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

suvarna-tammina avatar Feb 02 '17 08:02 suvarna-tammina

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

fbessou avatar Feb 02 '17 08:02 fbessou

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.

suvarna-tammina avatar Feb 02 '17 09:02 suvarna-tammina

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.

rgzr avatar Feb 02 '17 09:02 rgzr

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?

suvarna-tammina avatar Feb 02 '17 10:02 suvarna-tammina

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

fbessou avatar Feb 02 '17 13:02 fbessou

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

sergeik avatar Feb 03 '17 02:02 sergeik

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

suvarna-tammina avatar Feb 03 '17 03:02 suvarna-tammina

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

fbessou avatar Feb 03 '17 14:02 fbessou

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

suvarna-tammina avatar Feb 04 '17 05:02 suvarna-tammina

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

Using tag and import path with /src untitled

TheDarkX avatar Feb 06 '17 03:02 TheDarkX

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.

cyrilzaharchenko avatar Feb 08 '17 12:02 cyrilzaharchenko

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

Ragularuban avatar Feb 27 '17 09:02 Ragularuban

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

Iquebal avatar Mar 14 '19 12:03 Iquebal

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

Iquebal avatar Mar 14 '19 12:03 Iquebal