Repository navigation
A fix for Angular's template-driven forms: a new record after a save is no longer red.
| Package | Install | |
|---|---|---|
| TypeScript | ideablade-validation on npm |
npm i ideablade-validation@0.2.1 rxjs |
| .NET | IdeaBlade.Validation on NuGet |
dotnet add package IdeaBlade.Validation --version 0.2.1 |
What's changed since 0.2.0
- Angular: a field typed into no longer counts as touched on the next model (#38). When a template-driven form's
[validationModel]moved on to another model, the form cleared its controls' touched and dirty flags, but its own touch listener took the events that clearing emits while a control was still dirty. Every field the user had typed into then counted as touched on the new model, which showed those fields' errors at once: fill in a form, Save, start a new record, and it was red. Fields that were only left (not typed into) were already handled. The events still go out, for anything else that follows the controls. - React docs: reset the visibility when moving on to another record (#38).
useValidationtakes a different model object between renders to be the same model, edited (the copiesuseStatemakes), so a new record took over the fields touched on the previous one. Callvisibility.reset()in the handler that sets the new record: Showing errors. The library's behaviour is unchanged. - .NET: no changes. The package is 0.2.1 so both packages keep matching versions.
Requirements
Unchanged from 0.1.0:
- npm: ESM only; Node.js 22 or later for server-side use. Peer dependencies:
rxjs ^7.4; optionally@angular/coreand@angular/forms17.1 or later (22 for Signal Forms),react18 or later,breeze-client3. - NuGet: .NET Standard 2.0, .NET 8 and .NET 10.
Documentation
Concepts · Metadata reference · Validators · Expressions · Angular · React · Breeze · .NET
Notes
- Both packages were built from the tagged commit, d0ecefd.
- npm still shows the deprecated
0.0.0-stageplaceholder from staged publishing. Install0.2.1.
Full changelog: v0.2.0...v0.2.1