Git Product home page Git Product logo

recursion-ng-forms's Introduction

RecursionForms

Build Status

Demo: https://yiqu.github.io/recursion-ng-forms/

Form Structure:

  • Address (form control)

  • Year (form control)

  • Habitant (form group)

    • habitantName (form control)
    • age (form control)
    • dependents (form array)
      • The dependents array contains form groups that has a 'dependent_type' form control. The 'dependent_type' is a selection of 3 possible values: deceased, pet, or habitant. If habitant is chosen, display the Habitant form group again explained here.

The dependents form array could contain a Habitant, which in turn contains dependents which could contain Habitants. Thus a recursion is needed for creating and displaying the form.

Example result:

{
   "address":"1000 Friendly St.",
   "year":"2021",
   "habitant":{
      "habitantName":"Fist hab name",
      "age":"First hab age",
      "dependents":[
         {
            "dependent_type":"animal",
            "petName":"First hab's animal name"
         },
         {
            "dependent_type":"habitant",
            "habitant":{
               "habitantName":"Second hab name",
               "age":"Second hab age",
               "dependents":[
                  {
                     "dependent_type":"habitant",
                     "habitant":{
                        "habitantName":"Third hab name",
                        "age":"Third hab age",
                        "dependents":[
                           {
                              "dependent_type":"deceased"
                           },
                           {
                              "dependent_type":"habitant",
                              "habitant":{
                                 "habitantName":"Fourth hab name",
                                 "age":"Fourth hab age",
                                 "dependents":[
                                    {
                                       "dependent_type":null
                                    }
                                 ]
                              }
                           }
                        ]
                     }
                  }
               ]
            }
         }
      ]
   }
}

recursion-ng-forms's People

Contributors

yiqu avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.