Skip to content

Angular (2 and above) sample project which shows how to use the swagger-ts-generator and angular2-swagger-form-field modules. It implements functionality to use the generated classes for building form fields with validation.

License

Notifications You must be signed in to change notification settings

baibaomen/angular-swagger-form-field-sample

 
 

Repository files navigation

angular-swagger-form-field-sample

Angular (2 and above) sample project which shows how to use the swagger-ts-generator and angular-swagger-form-field packages.

It implements functionality to use the generated classes for building form fields with validation. See sample for a running sample of this repo.

Samples

Template driven

In the sample src/app/components/template-driven a traditional template driven form is implemented. It's just for reference so you can see what it takes to implement a form in the view.

Notice the verbosity and the repetetion of the validation stuff in the template-driven.component.html view.

Model driven

In the sample src/app/components/model-drivena reactive form is implemented without generated classes. The form groups are implemented in the model-driven.component.ts.

Notice that the view model-driven.component.html is less verbose than that of the template driven form.

Generated model driven

In the sample src/app/components/generated-model-drivena reactive form is implemented with form groups from the generated classes. The view is simular to that of the model driven component.

Notice that the component generated-model-driven.component.ts does not contain the form groups and validation rules. These are all generated using the swagger-ts-generator.

About

Angular (2 and above) sample project which shows how to use the swagger-ts-generator and angular2-swagger-form-field modules. It implements functionality to use the generated classes for building form fields with validation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 55.7%
  • HTML 28.3%
  • CSS 10.0%
  • JavaScript 6.0%