{"id":14972503,"url":"https://github.com/guzuomuse/ngx-myform","last_synced_at":"2026-01-28T20:04:37.331Z","repository":{"id":71802393,"uuid":"95719223","full_name":"guzuomuse/ngx-myform","owner":"guzuomuse","description":"rapid form development using angular 4 + and bootstrap v4---angular 表单快速开发模块，基于bootstrap 4 ui","archived":false,"fork":false,"pushed_at":"2017-07-08T04:18:06.000Z","size":91,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T02:42:58.235Z","etag":null,"topics":["angular","angular4","bootstrap","bootstrap4","form"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guzuomuse.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-28T23:15:02.000Z","updated_at":"2017-07-23T08:50:45.000Z","dependencies_parsed_at":"2023-06-10T20:45:42.349Z","dependency_job_id":null,"html_url":"https://github.com/guzuomuse/ngx-myform","commit_stats":{"total_commits":42,"total_committers":1,"mean_commits":42.0,"dds":0.0,"last_synced_commit":"a8ad29fb262434f8323969159a11320dbac6f401"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/guzuomuse/ngx-myform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzuomuse%2Fngx-myform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzuomuse%2Fngx-myform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzuomuse%2Fngx-myform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzuomuse%2Fngx-myform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guzuomuse","download_url":"https://codeload.github.com/guzuomuse/ngx-myform/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzuomuse%2Fngx-myform/sbom","scorecard":{"id":450484,"data":{"date":"2025-08-11","repo":{"name":"github.com/guzuomuse/ngx-myform","commit":"a8ad29fb262434f8323969159a11320dbac6f401"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"120 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-c75v-2vq8-878f","Warn: Project is vulnerable to: GHSA-3v6h-hqm4-2rg6","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-p28h-cc7q-c4fg","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-297x-8xj4-vcxv","Warn: Project is vulnerable to: GHSA-4859-gpc7-4j66","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-j4f2-536g-r55m","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq","Warn: Project is vulnerable to: GHSA-8g7p-74h8-hg48","Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-4hpf-3wq7-5rpr","Warn: Project is vulnerable to: GHSA-f522-ffg8-j8r6","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-7x7c-qm48-pq9c","Warn: Project is vulnerable to: GHSA-rc3x-jf5g-xvc5","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-5947-m4fg-xhqg","Warn: Project is vulnerable to: GHSA-779f-wgxg-qr8f","Warn: Project is vulnerable to: GHSA-82v2-mx6x-wq7q","Warn: Project is vulnerable to: GHSA-7px7-7xjx-hxm8","Warn: Project is vulnerable to: GHSA-x5pg-88wf-qq4p","Warn: Project is vulnerable to: GHSA-p9wx-2529-fp83","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-gwg9-rgvj-4h5j","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-9v62-24cr-58cx","Warn: Project is vulnerable to: GHSA-r8f7-9pfq-mjmv","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-q75g-2496-mxpp","Warn: Project is vulnerable to: GHSA-6fx8-h7jm-663j","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-7mwh-4pqv-wmr8","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-fxwf-4rqh-v8g3","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-xfhh-g9f5-x4m4","Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472","Warn: Project is vulnerable to: GHSA-mgfv-m47x-4wqp","Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv","Warn: Project is vulnerable to: GHSA-5v72-xg48-5rpm","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-72mh-269x-7mh5","Warn: Project is vulnerable to: GHSA-h4j5-c7cj-74xg","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T08:05:58.742Z","repository_id":71802393,"created_at":"2025-08-19T08:05:58.742Z","updated_at":"2025-08-19T08:05:58.742Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28850474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular4","bootstrap","bootstrap4","form"],"created_at":"2024-09-24T13:47:01.263Z","updated_at":"2026-01-28T20:04:37.317Z","avatar_url":"https://github.com/guzuomuse.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ngx-myform\nEasy to use,Flexible,Simple,Powerful Angular 4+ module with Bootstrap v4 ui for Rapid Form Development;\n# Demo screenShot:\n### pic1:Normal\n![pic1](https://lh3.googleusercontent.com/m4fZd7U4NhNMPj65LNOLc0edVcoOzv9EmMLwKFSL4DbDfV9yWzyDhNo3yjWqCWpknneJO4-Rtwuu5uh5uEwVWzT2pxVqaJUWahJljBp-X1EWizlll92TkByMbq0TbnhtvAm6KibYa65mbJrvuvHGin_jbZGHmo74I4iSdpbmF04U9M3JNn-Mr_uRuO4oTkWYp7UbCMcQS1vIuzIALil4m4iSK0SYF_wmPeR8pgDxPcybaSdkAuMCCi4xJCKNaOoJYQfNwrX98fuzJUFCaNqAt9Ns2zpLJ80mKyN2HT3hJxNYSbKVIM6sYybpCoHmzRVIMmpIY3eljMSpMIDxTHTuAiyY29JjN8gTEQJ-dW3I5StP8kS7zAs1PG5_D7vABHjWEpSn7P_1HUnT44SZxHa1GF7bQEoEkWFDgHNR611vrb29drA28wVY87jLr8bb4rQwQEyT-FCWZ7KAlKKf6vI3sEU8nP2a7t02AJQfdV9az-jLW7ycJqt2mS-K11SBFVTNd4afXCwfEQHFR-xMFrro-CU4714D99dDceybtYcyOvTdNBQYIR1wcN5bMb8fDJ1v5nvEUxX9ZK4yuZ42_TuPvM_utO-V66UXSVuFTLId8BVo3aMdiZ--qALXNi4fdBDQsQNDEhhF45d2yiVBvjSVkNu6MACTum9KBGPK7DFcQxPG=w636-h741-no)\n### pic2:Use Bootstrap 4 Grid\n![pic2](https://lh3.googleusercontent.com/EjMbZ_jRuvz1XF4OsqC_on45U35Q-lZwmTr69o06S6O2yqzVJnOXbP5ppS6arktcpqbCvBMD8IiVLuDJQ57vyXR1cmU2TW6l2FhO3XWWnjzTceUDVxraWkT1Oq5_S9cG4H3hcwF-6zlzDGCuTKSCLHhYcihR65utQXAvRNZBdXcwEicIBUkJyl0whFBGkOZBUr03vajyczOvVa-gV1Vu1MnJN23en1ZsWSRMq0fa8n50gubZAsLkepU8tUXpn7B0Ni7AVT0Vehht7qanfyvcdUKcoT_kQ7RUUZi6cbQREN2OGBLW385_M58Iu9B6oogcYCK24bd8UU86IBBxB9ADdVFXWggk9EsaxArajbKI_K5Uw9SBqcBowUc9Xbk05SIh8QNGZPsHbuuETuwrP4lvO9UlZltJOuyN3ZuHm1uKIYTZtN0fraOJ0hQQtxxNxmAEg7XgL9xZETPSRCKL4s_03R-uRlFr88FF_Qh6tkd66aRq6VoNHWljdmKqStcxXz0VRGgAiqu4WxOrXL70tIXtiZfYV04gBYbilgOeWnhIZTIwxXI7r0gEiE7EPtRRNMT-HRbJlIfzmZt6FIqgviy0jATnmfP9S_6uI9H2HaE3lSRyO0Y7pV_aiZ3vnYFslBFKsd27N_dtmnV1y8CdR975B8vnpu84ENnNsrLPoyfJTw1g=w726-h742-no)\n\n## Table of Contents\n\n[Installation](#installation)\n\n[Usage](#usage)\n\n[FormConfig](#formconfig)\n\n[ModelTypes](#modeltypes)\n\n[ModelConfig](#modelconfig)\n\n[demo repository](https://github.com/guzuomuse/ngx-myform-demo)\n\n\n\n## Installation\n\n```bash\n$ npm install ngx-myform --save\n$ yarn add ngx-myform\n```\n## Usage\n\nOnce you have installed the library, you need some preparations:\n\n1: set bootstrap v4 global style\n   if your app based on angular-cli see [here](https://github.com/angular/angular-cli/wiki/stories-global-styles); how to configure global style\n   for example:\n   ```json\n  \"styles\": [\n      \"../node_modules/bootstrap/dist/css/bootstrap.css\",\n      \"styles.css\"\n  ],\n   ```\n2: import the module:\n```typescript\n// Import your library\nimport { NgxMyFormModule } from 'ngx-myform';\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    NgxMyFormModule.forRoot(),\n    ...\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n3:in you component `YourComponent.ts`\n\n```typescript\nimport { Component, OnInit } from '@angular/core';\nimport { FormConfig, InputModel, GroupModel, TextareaModel, SelectModel, RadiogroupModel, CheckboxGroupModel, CheckboxModel, } from 'ngx-myform';\nimport { FormGroup, Validators, ValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';\nfunction customeValidator(): ValidatorFn {\n  return (g: FormGroup) =\u003e {\n    return g.get('password').value === g.get('repassword').value\n      ? null : { mismatch: true };\n  }\n}\nfunction customValidatorOtherFormat(g: FormGroup) {\n  return g.get('password').value === g.get('repassword').value\n    ? null : { mismatch: true };\n}\nfunction customEmailValidator(): ValidatorFn {\n  return (c: AbstractControl) =\u003e {\n    if (!c.value) { return null; }\n    const reg = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n    return reg.test(c.value) ? null : { email_validator_key: true }\n  }\n}\nfunction customEmailduplicated(control: AbstractControl) {\n  const q = new Promise\u003c{ [key: string]: boolean }\u003e((resolve, reject) =\u003e {\n    setTimeout(() =\u003e {\n      if (control.value === 'test@gmail.com') {\n        resolve({ 'duplicated': true });\n      } else {\n        resolve(null);\n      }\n    }, 1000);\n  });\n  return q;\n}\nfunction customCheckboxGroupValidator_1(g: FormGroup) {\n  return g.get('checkbox_4').value\n    ? null : { shouldlike: true };\n}\nfunction customCheckboxGroupValidator_2(g: FormGroup) {\n  const num = Object.keys(g.controls).reduce((curr, key) =\u003e {\n    if (g.get(key).value) {\n      curr++;\n    }\n    return curr;\n  }, 0);\n  return num \u003e 2 ? null : {\n    shouldlikeatleast: true\n  }\n}\n@Component({\n  selector: 'app-demo1',\n  templateUrl: './demo1.component.html',\n  styleUrls: ['./demo1.component.css'],\n})\nexport class Demo1Component implements OnInit {\n  models = [\n    new InputModel({\n      id: 'username',\n      label: 'username:(use custom class `label_class_1`)',\n      validators: [\n        { key: 'required', validator: Validators.required, message: 'username is required' },\n        { key: 'minlength', validator: Validators.minLength(3), message: 'username must 3 chars at least' }\n      ],\n      wrappersClass: {\n        labelWrapper: ['label_class_1'],\n      },\n    }),\n\n    new InputModel({\n      id: 'age',\n      label: 'your age:',\n      disabled: true,\n      value: \"it's a secret :)\"\n    }),\n    new InputModel({\n      id: 'niceperson',\n      label: '\u003cdiv style=\"color:blue;\"\u003ea nice person?(html label support)\u003c/div\u003e',\n      value: 'definitly',\n      attributes: {\n        readonly: 'readonly',\n      }\n    }),\n    new InputModel({\n      id: 'avatar',\n      label: 'avatar:',\n      attributes: {\n        type: 'file',\n        multiple: 'multiple'\n      },\n      events: {\n        change: (e) =\u003e {\n          console.log(e.target.files);\n        }\n      }\n    }),\n    new CheckboxGroupModel({\n      id: 'intrests',\n      // inline: false,\n      label: 'what do you like:',\n\n      options: [\n        {\n          id: 'checkbox_1',\n          checkLabel: 'basketball',\n        },\n        {\n          id: 'checkbox_2',\n          checkLabel: 'football',\n        },\n        {\n          id: 'checkbox_3',\n          checkLabel: 'swimming',\n        },\n        {\n          id: 'checkbox_4',\n          checkLabel: 'reading',\n        },\n        {\n          id: 'checkbox_5',\n          checkLabel: 'music',\n        },\n      ],\n      validators: [\n        { key: 'shouldlike', validator: customCheckboxGroupValidator_1, message: 'why not like reading?' },\n        { key: 'shouldlikeatleast', validator: customCheckboxGroupValidator_2, message: 'you should like at least 3 item' }\n      ],\n    }),\n    new GroupModel({\n      id: 'passwordGroup',\n      group: [\n        new InputModel({\n          id: 'password',\n          label: 'password:',\n          // disabled: true,\n          attributes: {\n            type: 'password',\n          },\n          validators: [\n            { key: 'required', validator: Validators.required, message: 'password is required' }\n          ],\n        }),\n        new InputModel({\n          id: 'repassword',\n          label: 're-password:',\n\n          attributes: {\n            type: 'password',\n          },\n          validators: [\n            { key: 'required', validator: Validators.required, message: 'please retype your password' }\n          ],\n        }),\n      ],\n      validators: [\n        { key: 'mismatch', validator: customeValidator(), message: 'the password not match' },\n      ],\n    }),\n    new InputModel({\n      id: 'email',\n      label: 'email:',\n\n      prefix: {\n        html: '@',\n        class: ['input-group-addon'],\n      },\n      validators: [\n        { key: 'email_validator_key', validator: customEmailValidator(), message: 'invalid Email' }\n      ],\n      asyncValidators: [\n        { key: 'duplicated', validator: customEmailduplicated, message: 'Email is already existed!' }\n      ],\n      wrappersClass: {\n        controlWrapper: ['input-group']\n      },\n    }),\n    new InputModel({\n      id: 'phone',\n      label: 'phone number:',\n\n      validators: [\n        { key: 'required', validator: Validators.required, message: 'please fill the phone number' }\n      ],\n    }),\n    new InputModel({\n      id: 'verificationcode',\n      label: 'verifacation code:',\n\n      validators: [{ key: 'required', validator: Validators.required, message: 'this is required' }],\n      suffix: {\n        html: '\u003cbutton type=\"button\" class=\"btn btn-success\" onclick=\"alert(\\'send me verificaton code!\\');\"\u003esend code\u003c/button\u003e',\n        class: ['border-0', 'ml-3', 'p-0'],\n      },\n      wrappersClass: {\n        controlWrapper: ['input-group']\n      },\n    }),\n    new SelectModel({\n      id: 'country',\n      label: 'country:',\n\n      value: 'england',\n      options: [\n        { label: 'select one country', value: '' },\n        { label: 'China', value: 'china' },\n        { label: 'USA', value: 'usa' },\n        { label: 'Japan', value: 'japan' },\n        { label: 'England', value: 'england' },\n        { label: 'France', value: 'france' },\n      ],\n      validators: [\n        { key: 'required', validator: Validators.required, message: 'country is required' }\n      ],\n      events: {\n        change: () =\u003e {\n          console.log('ok--changed!');\n        }\n      }\n    }),\n    new SelectModel({\n      id: 'occupation',\n      attributes: {\n        multiple: 'multiple',\n      },\n      label: 'occupation:',\n      validators: [{ key: 'required', validator: Validators.required, message: 'occupation is required' }],\n      options: [\n        { label: 'Programmer', value: 'programmer' },\n        { label: 'Teacher', value: 'teacher' },\n        { label: 'Dodctor', value: 'doctor' },\n        { label: 'Driver', value: 'driver' }\n      ],\n    }),\n    new RadiogroupModel({\n      id: 'gender:',\n      label: 'gender:',\n      legend: {\n        value: 'Radio Group Legend!',\n      },\n      inline: true,\n      options: [\n        { label: 'Male', value: 'male' },\n        { label: 'Female', value: 'female' },\n        { label: 'xxx', value: 'xxx', disabled: true }\n      ],\n      validators: [\n        { key: 'required', validator: Validators.required, message: 'the gender is required' }\n      ],\n    }),\n    new CheckboxModel({\n      id: 'agree',\n      value: true,\n      required: true,\n      checkLabel: 'agree some terms?',\n      validators: [\n        { key: 'required', validator: Validators.required, message: 'you must agree these terms' }\n      ],\n    }),\n  ];\n  formConfig: FormConfig = {\n    models: this.models,\n    attributes: {\n      autocomplete: 'off',\n    },\n    showErrorsOnSubmit: true,\n  };\n  constructor() { }\n  ngOnInit() {\n  }\n\n  test_submit(form) {\n    console.log('test_submit', form.value);\n  }\n  test_change(data) {\n    console.log('test_change', data);\n  }\n}\n\n```\n4: in the template `YourComponent.html`;\n```html\n\u003cngx-bootstrap-form [formConfig]=\"formConfig\" (ngSubmit)=\"test_submit($event);\" #myform (ngValueChange)='test_change($event);'\u003e\n  \u003cbutton class=\"btn btn-primary\" type=\"submit\"\u003esubmit\u003c/button\u003e\n\u003c/ngx-bootstrap-form\u003e\n```\n## FormConfig\nsay it's easy to use,because,you just need to configure a json format data; and bind this data to the `ngx-bootstrap-form` form component;\n```typescript\ninterface FormConfig {\n    models: BaseModel[],\n    attributes?: { [key: string]: string },\n    wrappersClass?: WrappersClassInterFace,\n    showErrorsOnSubmit?: boolean;\n}\n```\n# models:\nmodels is an array in which the basic form elements are include for exaple: `InputModel` represents input element\n`SelectModel` represents select element.\n# attributes:\nyou can use dynamically set any attibute for your form\nattributes:{\n   'autocomplete':'off',\n}\nthe form will add  `\"autocomplete\"=\"off\"` to you form\n# wrappersClass:\nbefore talking about The \"wrappersClass\";let's see the  DOM structuor for a model,pseudo code:\n```html\n\u003cdiv mainWrapper\u003e\n  \u003clabel labelWrapper\u003e\u003c/label\u003e\n  \u003cdiv secondaryWrapper\u003e\n    \u003cdiv controlWrapper\u003e\n      \u003cdiv prefix\u003e\u003c/div\u003e\n      input|select|radio|checkbox|radiogroup|checkgroup...\n      \u003cdiv suffix\u003e\u003c/div\u003e\n    \u003c/div\u003e\n    \u003cdiv form-conrol-feedback\u003esome error message\u003c/div\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\nif you are familar with bootstrap v4 it should be easy to understand;it's based on the bootstrap form structor;\nso,the purpose of `WrappersClass` is just **Globally** configure  for form layout while every model also  has this individually;\n\nyou can custom any class with:\n```html\n{\n   models:...\n   attributes:...\n   wrappersClass:{\n      mainWrapper:['custom_class_1','custom_class_2',...],\n      labelWrapper:[...],\n      ....\n   },\n   ...\n}\n```\n## ModelTypes\n\n`InputModel, TextareaModel, SelectModel, CheckboxModel, RadiogroupModel, CheckboxGroupModel,GroupModel`\n\nGroupModel is a special model which used for creating FormGroup; for example:\n```typescript\nmodels=[\n   new InputModel({...}),\n   ...\n   new GroupModel({\n      id:'anyid',\n      group:[// the `group` is the same as the `model`;\n         new InputModel({...}),\n         new SelectModel({...}),\n         ....\n      ],\n   }),\n   new CheckBoxModel({...}),\n   ...\n];\n```\n## ModelConfig\n   ```typescript\n   {\n    id: string;\n    value?: string | boolean;\n    disabled?: boolean;\n    attributes?: { [key: string]: string };\n    events?: { [key: string]: (any) =\u003e void };\n    validators?: {\n        key: string,\n        validator: ValidatorFn | ValidationErrors,\n        message?: string,\n    }[];\n    asyncValidators?: {\n        key: string,\n        validator: AsyncValidatorFn | ValidationErrors,\n        message?: string,\n    }[];\n    wrappersClass?: WrappersClassInterFace;\n    label?: {\n        html?: string,\n        class?: Array\u003cstring\u003e,\n    };\n    prefix?: {\n        html?: string,\n        class?: Array\u003cstring\u003e,\n    };\n    suffix?: {\n        html?: string,\n        class?: Array\u003cstring\u003e,\n    };    \n   }\n   ```\n## License\n\nMIT © [guzuomuse]\n\"# ngx-myform\" ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzuomuse%2Fngx-myform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguzuomuse%2Fngx-myform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzuomuse%2Fngx-myform/lists"}