Skip to content

Repository files navigation

⚡ Ionic API TechData

  • Displays a reactive form with controls defined in a JSON file
  • Code from Joshua Morony - see 👏 Inspiration below
  • Note: to open web links in a new window use: ctrl+click on link

GitHub repo sizeGitHub pull requestsGitHub Repo starsGitHub last commit

📄 Table of contents

📚 General info

📷 Screenshots

techData screen print

📶 Technologies

💾 Setup

  • Load dependencies using npm i,
  • To start the server on localhost://8100 type: 'ionic serve'

💻 Code Examples

  • json-form.component.ts method to create a form from the data-form.json values
createForm(controls: IJsonFormControls[]){for(constcontrolofcontrols){constvalidatorsToAdd=[];for(const[key,value]ofObject.entries(control.validators)){switch(key){case'min':
validatorsToAdd.push(Validators.min(value));break;case'max':
validatorsToAdd.push(Validators.max(value));break;case'required':
if(value){validatorsToAdd.push(Validators.required);}break;case'requiredTrue':
if(value){validatorsToAdd.push(Validators.requiredTrue);}break;case'email':
if(value){validatorsToAdd.push(Validators.email);}break;case'minLength':
validatorsToAdd.push(Validators.minLength(value));break;case'maxLength':
validatorsToAdd.push(Validators.maxLength(value));break;case'pattern':
validatorsToAdd.push(Validators.pattern(value));break;case'nullValidator':
if(value){validatorsToAdd.push(Validators.nullValidator);}break;default:
break;}}this.dataForm.addControl(control.name,this.fb.control(control.value,validatorsToAdd));}console.log('data form: ',this.dataForm);}

🆒 Features

  • Defines reactive form controls from a JSON file

📋 Status & To-do list

  • Status: Working
  • To-do: Nothing

👏 Inspiration

📁 License

  • N/A

✉️ Contact

  • Repo created by ABateman, email: gomezbateman@yahoo.com

About

📋 Displays a reactive form with controls defined in a JSON file. Code from Josh Morony.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages