ngspot / ngx-errors Goto Github PK
View Code? Open in Web Editor NEWAngular directives for displaying validation errors
License: MIT License
Angular directives for displaying validation errors
License: MIT License
Hey Dmitry,
Can you update this to support version 2.4.0 of tslib?
Thanks!
We are able to setup the module to show errors only for dirty inputs OR form submission. I mean if we use both true
than we show errors only on form submission.
Show error:
As a product manager, I want the user to see form errors in both cases:
As a product manager, I want the user to see form errors when he tab through a required field without editing it.
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
I just downloaded 3.2.0, which successfully solves #9.
Although I can't resist the feeling that there is another problem. The html templates don't update with ngxErrors
immediately, sometimes I need to make several changes and saves before the ngxErrors
html kicks in. Will have to try to reproduce it on Stackblitz before I am sure this is not my setup
The problem I am facing is that the syntax for displaying error details
<div ngxErrors="password">
<div ngxError="passwordLength" #myMin="ngxError">
Password has to be at least {{myMin.err.min}} characters long.
Only {{myMin.err.actual}} typed
</div>
</div>
doesn't seem to update as I am typing.
This is a reactive form:
this.fb.group({
password: ['', [passwordLengthValidator()]],
});
This is my custom validator:
export const passwordLengthValidator = (min = 16): ValidatorFn =>
(c: AbstractControl) => {
console.log('validating', c.value)
if(c.value.trim() === ''){
return null
}
const actualLen = c.value.length;
return actualLen >= min
? null
: { passwordLength: { min, actual: actualLen }};
}
Am I doing anything wrong? (changeDetection
left at default.)
Will provide stackblitz later if successful.
Angular version: 13.1.2
ngx-errors: 3.2.0
nx workspace
lazy loaded module
reactive form
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Currently supporting Angular versions till 13
Need to support Angular 14 and 15
Angular version: X.Y.Z
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
The ngxError
directive can show simple message as an error.
The ngxError
directive can use different data that comes from validation error.
For example for Validators.minLength we can have such data in error: {requiredLength: 10, actualLength: 8}
. And we can show user an error: Min length for this field: 10; Actual length: 8
There might be cases when we want to show rich errors for user with additional data comes from Validator.
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Support request
[ ] Other... Please describe:
Dependency on angular/material errors when compiling
No such dependency or making it optional.
nx workspace
angular 13.1
ngx-errors 3.1.5
Following errors in the console:
./node_modules/@ngspot/ngx-errors/fesm2015/ngspot-ngx-errors.mjs:3:0-45 - Error: Module not found: Error: Can't resolve '@angular/material/core' in '......../node_modules/@ngspot/ngx-errors/fesm2015'
./node_modules/@ngspot/ngx-errors/fesm2015/ngspot-ngx-errors.mjs:9:0-48 - Error: Module not found: Error: Can't resolve '@angular/material/input' in '........../node_modules/@ngspot/ngx-errors/fesm2015'
Angular version: X.Y.Z
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
Do I really need to install angular/material if I don't need it otherwise? What is that that needs to be imported from angular/material for displaying error messages, please?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.