{"id":13808583,"url":"https://github.com/Ninja-Squad/ngx-valdemort","last_synced_at":"2025-05-14T02:32:05.825Z","repository":{"id":32563223,"uuid":"135720882","full_name":"Ninja-Squad/ngx-valdemort","owner":"Ninja-Squad","description":"Simpler, cleaner Angular validation error messages","archived":false,"fork":false,"pushed_at":"2024-10-29T18:18:11.000Z","size":17292,"stargazers_count":202,"open_issues_count":5,"forks_count":6,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-29T20:24:55.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ngx-valdemort.ninja-squad.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ninja-Squad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-06-01T13:27:21.000Z","updated_at":"2024-10-29T19:31:20.000Z","dependencies_parsed_at":"2024-09-15T22:47:48.384Z","dependency_job_id":"f6b32364-4aa4-4a8e-8821-d0a6248179a7","html_url":"https://github.com/Ninja-Squad/ngx-valdemort","commit_stats":{"total_commits":2064,"total_committers":6,"mean_commits":344.0,"dds":0.5203488372093024,"last_synced_commit":"a373804d8f3df788b6330383c30d7d79d3ea94ff"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ninja-Squad%2Fngx-valdemort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ninja-Squad%2Fngx-valdemort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ninja-Squad%2Fngx-valdemort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ninja-Squad%2Fngx-valdemort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ninja-Squad","download_url":"https://codeload.github.com/Ninja-Squad/ngx-valdemort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224844651,"owners_count":17379241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-04T01:01:46.776Z","updated_at":"2024-11-19T00:30:51.928Z","avatar_url":"https://github.com/Ninja-Squad.png","language":"TypeScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Form Validation"],"readme":"[![CircleCI](https://circleci.com/gh/Ninja-Squad/ngx-valdemort.svg?style=svg)](https://circleci.com/gh/Ninja-Squad/ngx-valdemort)\n[![Codecov](https://codecov.io/gh/Ninja-Squad/ngx-valdemort/branch/master/graph/badge.svg)](https://codecov.io/gh/Ninja-Squad/ngx-valdemort)\n\n# ngx-valdemort\n\nngx-valdemort gives you simpler, cleaner validation error messages for your Angular components.\n\n## Why should you care?\n\nIf you've ever written forms like the following:\n\n```html\n\u003cform [formGroup]=\"form\" (ngSubmit)=\"submit()\" #f=\"ngForm\"\u003e\n  \u003cinput formControlName=\"email\" type=\"email\" /\u003e\n  @if (form.controls.email.invalid \u0026\u0026 (f.submitted || form.controls.email.touched)) {\n    \u003cdiv class=\"invalid-feedback\"\u003e\n      @if (form.controls.email.hasError('required')) {\n        \u003cdiv\u003eThe email is required\u003c/div\u003e\n      }\n      @if (form.controls.email.hasError('email')) {\n        \u003cdiv\u003eThe email must be a valid email address\u003c/div\u003e\n      }\n    \u003c/div\u003e\n  }\n\n  \u003cinput formControlName=\"age\" type=\"number\" /\u003e\n  @if (form.controls.age.invalid \u0026\u0026 (f.submitted || form.controls.age.touched)) {\n    \u003cdiv class=\"invalid-feedback\"\u003e\n      @if (form.controls.age.hasError('required')) {\n        \u003cdiv\u003eThe age is required\u003c/div\u003e\n      }\n      @if (form.controls.age.hasError('min')) {\n        \u003cdiv\u003eYou must be at least {{ form.controls.age.getError('min').min }} years old\u003c/div\u003e\n      }\n    \u003c/div\u003e\n  }\n\n  \u003cbutton (click)=\"submit()\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\nngx-valdemort allows writing the above form in a simpler, cleaner way by using the `ValidationErrorsComponent`:\n\n```html\n\u003cform [formGroup]=\"form\" (ngSubmit)=\"submit()\"\u003e\n  \u003cinput formControlName=\"email\" type=\"email\" /\u003e\n  \u003cval-errors controlName=\"email\"\u003e\n    \u003cng-template valError=\"required\"\u003eThe email is required\u003c/ng-template\u003e\n    \u003cng-template valError=\"email\"\u003eThe email must be a valid email address\u003c/ng-template\u003e\n  \u003c/val-errors\u003e\n\n  \u003cinput formControlName=\"age\" type=\"number\" /\u003e\n  \u003cval-errors controlName=\"age\"\u003e\n    \u003cng-template valError=\"required\"\u003eThe age is required\u003c/ng-template\u003e\n    \u003cng-template valError=\"max\" let-error=\"error\"\u003eYou must be at least {{ error.min }} years old\u003c/ng-template\u003e\n  \u003c/val-errors\u003e\n\n  \u003cbutton\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\nEven better, you can define default error messages once, and use them everywhere, while still being able to\noverride them when needed:\n\n```html\n\u003cform [formGroup]=\"form\" (ngSubmit)=\"submit()\"\u003e\n  \u003cinput formControlName=\"email\" type=\"email\" /\u003e\n  \u003cval-errors controlName=\"email\" label=\"The email\"\u003e\u003c/val-errors\u003e\n\n  \u003cinput formControlName=\"age\" type=\"number\" /\u003e\n  \u003cval-errors controlName=\"age\" label=\"The age\"\u003e\n    \u003cng-template valError=\"max\" let-error=\"error\"\u003eYou must be at least {{ error.min }} years old\u003c/ng-template\u003e\n  \u003c/val-errors\u003e\n\n  \u003cbutton\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\nIt works with `ngModel` too!\n\n```html\n\u003cinput class=\"form-control\" type=\"email\" name=\"email\" [(ngModel)]=\"user.email\" required email #emailCtrl=\"ngModel\" /\u003e\n\u003cval-errors [control]=\"emailCtrl.control\" label=\"The email\"\u003e\u003c/val-errors\u003e\n```\n\nLearn more and see it in action on [our web page](https://ngx-valdemort.ninja-squad.com/)\n\n## Installation\n\nUsing the CLI: `ng add ngx-valdemort`\n\nUsing npm: `npm install ngx-valdemort`\n\nUsing yarn: `yarn add ngx-valdemort`\n\n## Getting started\n\n- Import `ValdemortModule`, and other needed classes from ngx-valdemort\n- Add the module to the imports of your application module\n- Use `\u003cval-errors\u003e` in your forms\n- Enjoy!\n\nGo further:\n\n- define default error messages using `\u003cval-default-errors\u003e`\n- configure the look and feel globally by injecting and customizing the `ValdemortConfig` service\n\n## Issues, questions\n\nPlease, provide feedback by filing issues, or by submitting pull requests, to the [Github Project](https://github.com/Ninja-Squad/ngx-valdemort).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNinja-Squad%2Fngx-valdemort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNinja-Squad%2Fngx-valdemort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNinja-Squad%2Fngx-valdemort/lists"}