Skip to content

How to customized new widget? #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
qwe852147 opened this issue Mar 8, 2017 · 2 comments
Closed

How to customized new widget? #32

qwe852147 opened this issue Mar 8, 2017 · 2 comments

Comments

@qwe852147
Copy link

How to customized new widget? Example:file upload?
If I customized a new widget,schema and form which one I show put customized type in?

@qwe852147
Copy link
Author

I got it .
1.
Customized a new widget should add a new component which is your widget .

Then in your component which have your "schema" or " form" import "WidgetLibraryService" from 'angular2-json-schema-form' and import your new widget component.

Declare new variable which similar following

constructor( widgetLibrary: WidgetLibraryService) {
     widgetLibrary.registerWidget('fileupload', FileComponent);
  }

The fileupload is my add type and FileComponent is the type component

4.In your app module import your component and put it in "declarations" and "entryComponents" similar following

declarations: [     
        FileComponent
    ],   
       entryComponents:[
         FileComponent
]

@neil-coutinho
Copy link

@qwe852147 do you have a working fiddle or sample code on your custom widget?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants