Giter Club home page Giter Club logo

ngx-validator's Introduction

Hi, I'm why520crazy 😄

A fullstack engineer who love open source and new technology, be good at Angular、TypeScript and Node.js. is a middle-aged man who insists on writing code.

I am working on projects

  • planet: A powerful, reliable, fully-featured and production ready Micro Frontend library for Angular.
  • docgeni: A modern and powerful documentation generator for Angular components lib and markdown docs

About me

Leading products

  • 🌱 Worktile: Common project collaboration software.
  • 🌱 PingCode: Intelligent R&D management tool.

ngx-validator's People

Contributors

dependabot[bot] avatar luxiaobei avatar why520crazy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ngx-validator's Issues

Angular 9 upgrade?

Hi,
I am getting this warnings when I am using angular 9

npm WARN @why520crazy/[email protected] requires a peer of @angular/common@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @why520crazy/[email protected] requires a peer of @angular/forms@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @why520crazy/[email protected] requires a peer of @angular/core@^7.0.0 but none is installed. You must install peer dependencies yourself.

Can be a problem?

Unrecognized [ngxFormValidator]

Nice validator, but I have problem with validation

Unrecognized [ngxFormValidator]

<form [formGroup]="signinForm" (ngxFormSubmit)="signin()" novalidate [ngxFormValidator]="validatorConfig">

Error:

core.js:12584 ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngxFormValidator' since it isn't a known property of 'form'. ("ext-18">Sign In
<form [formGroup]="signinForm" (ngxFormSubmit)="signin()" novalidate [ERROR ->][ngxFormValidator]="validatorConfig">


<label for=""): ng:///SessionsModule/SigninComponent.html@8:79
Error: Template parse errors:
Can't bind to 'ngxFormValidator' since it isn't a known property of 'form'. ("ext-18">Sign In
<form [formGroup]="signinForm" (ngxFormSubmit)="signin()" novalidate [ERROR ->][ngxFormValidator]="validatorConfig">

<label for=""): ng:///SessionsModule/SigninComponent.html@8:79
at syntaxError (compiler.js:2547)
at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:19495)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:25041)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:25028)
at compiler.js:24971
at Set.forEach ()
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:24971)
at compiler.js:24881
at Object.then (compiler.js:2538)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:24880)
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at zone.js:873
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:14134)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)

Function calls are not supported in decorators

Hi:
i use this library in ionic with angular 7+. and i custom the ValidationFeedbackStrategy, it work on development env as well, but has error when build on production:

ERROR in app/app.module.ts(39,40): Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'AppValidationFeedbackStrategy' was called.

[ERROR] An error occurred while running subprocess ng.
        
        ng run app:ionic-cordova-build:production --platform=android exited with exit code 1.

what is happened ?
i had google this error, but not get any answer , please help me,thanks!

app.module.ts

...
imports: [
    BrowserModule,
    IonicModule.forRoot({
      animated: true,
      backButtonText: ''
    }),
    AppRoutingModule,
    IonicStorageModule.forRoot({
      name: '__iotfactorydb',
    }),
    HttpClientModule,
    NgxValidatorModule.forRoot({
      validationFeedbackStrategy:  new AppValidationFeedbackStrategy(),            <-- error line 
      validateOn: 'blur'
    }),
  ],
...

Programatically call ngxFormSubmit

If I have

formRef: NgForm;

and then later

if (this.formRef) {
   (this.formRef.ngSubmit.emit();
 }

can I somehow programmatically get "ngxFormSubmit" and not "ngSubmit"? I have generic form.

Thank you

form.valid

Is there any possibility to do a check like form.valid?

I need status if form is valid with tru or false

Thank you

Form validation in Components

Hi! I'd like to know if it's possible to validate the inputs in an external component inside a main form, like this case:

<form name="formname" novalidate [ngxFormValidator]="validatorConfig">
<section-sec1></section-sec1>
<section-sec2></section-sec2>
<button type="button" (ngxFormSubmit)="submit()" class="btn btn-primary">Submit</button>
</form>

where inside the section-sec1 and section-sec2 I have some input tag like this:

<input type="text" class="form-control" name="Address" id="Address" [(ngModel)]="Address" required />

Thanks!

Can not use global validation messages

I would like to use english as main language for errors but I can not override validation messages. It is still in your language.

Code:

const DEFAULT_GLOBAL_VALIDATION_MESSAGES = {
  required: 'This option cannot be empty',
  maxlength: 'The length of this option input cannot be greater than {requiredLength}',
  minlength: 'The length of this option input cannot be less than {requiredLength}',
  ngxUniqueCheck: 'The input value already exists, please re-enter',
  email: 'The format of the input message is incorrect',
  repeat: 'Inconsistent input twice',
  pattern: 'The option input format is incorrect',
  number: 'Must enter a number',
  url: 'The input URL format is incorrect',
  max: 'The input value of this option cannot be greater than {max}',
  min: 'The input value of this option cannot be less than {min}'
};

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    SharedComponentsModule,
    SessionsRoutingModule,
    NgxValidatorModule.forRoot({
      validateOn: 'submit',
      globalValidationMessages: DEFAULT_GLOBAL_VALIDATION_MESSAGES
    }),
  ],
  declarations: [SigninComponent]
})
export class SessionsModule { }

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.