formly-js / angular-formly-website

The website for angular-formly
http://angular-formly.com
18 stars 26 forks source link

New Example: Use Mongoose Schema #12

Open mikeerickson opened 9 years ago

mikeerickson commented 9 years ago

I was doing some comparison between 'schema form' and 'formly' and it dawned on me, it would be nice to use an existing Mongoose schema as the source for fields, validation, etc.

kentcdodds commented 9 years ago

Totally, terrific example idea. Would probably be very similar to http://angular-formly.com/#/example/very-advanced/oim

mikeerickson commented 9 years ago

You are indeed correct, that is basically what needs to be done (using the OIM approach). I will mess around with this and see what I can come up with.

FWIW, this is a 'comparison' issue with the other tool as it is based on schema (it doesn't have Mongoose connection either so ... )

kentcdodds commented 9 years ago

I should note, that there's an entire repo already initialized to add json-schema support to angular-formly as a plugin: https://github.com/formly-js/angular-formly-json-schema

mikeerickson commented 9 years ago

Fantastic, that looks yummy!

mikeerickson commented 9 years ago

Can you please confirm contents of this repo? There are only two files (README and LICENSE) ??

kentcdodds commented 9 years ago

Yes, this is true. I started a branch a while ago in angular-formly core to add support but didn't have time to work on it. Obviously it'll be implemented a bit differently now, but here's the starting point: https://github.com/formly-js/angular-formly/commit/14db7819173cb7fa133a59e7f5668407adb6e0f1

There may be changes necessary to angular-formly to enable this, and that's fine. But I'd like it to be fairly minimal.

mikeerickson commented 9 years ago

Ahhhhh, misunderstood what you said.

kentcdodds commented 9 years ago

Nah, I still want an example of doing something like this with mongoose :-)

mikeerickson commented 9 years ago

Well, this I will do just that :)