JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.14k stars 298 forks source link

Error With Angular modules, Angular 15 #1062

Closed GlauberF closed 1 year ago

GlauberF commented 1 year ago

🐞 bug report

Description

i recently updated my angular application to version 15 and i started to run into the error.

./src/@vimbo/components/table/content-per-type/content-mask/content-mask.module.ts:12:60-81 - Error: export 'NgxMaskModule' (imported as 'NgxMaskModule') was not found in 'ngx-mask' (possible exports: INITIAL_CONFIG, NEW_CONFIG, NGX_MASK_CONFIG, NgxMaskApplierService, NgxMaskDirective, NgxMaskPipe, NgxMaskService, initialConfig, provideEnvironmentNgxMask, provideNgxMask, timeMasks, withoutValidation)

I understood that it changed, I looked in the description now I can no longer use it that way

@NgModule({
     imports: [NgxMaskModule.forRoot()],
     declarations: [],
     exports: [],
     providers: []
})

and yes that way

@NgModule({
   imports: [
       NgxMaskDirective, NgxMaskPipe
   ],
   providers: [provideNgxMask()]
})

But for me this last option does not work, it shows the following error.

that is, I cannot change component by component that uses mask, because my system is big.

Angular version 15.1.1. Version of ngx-mask 15.0.2.

Solat-Ali commented 1 year ago

+1 I'm having the exact same error! Please let us know if we have any solutions for this?

NepipenkoIgor commented 1 year ago

@GlauberF @Solat-Ali Thank you that using ngx-mask Since ng14 and not in ng15 we have changes in API that we described in README Please check this example https://stackblitz.com/edit/angular-13-mc8tvg?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.module.ts,src%2Fapp%2Fapp.component.html

If you still have a problem please provide more context and maybe stackblitz example that relative to your environment

NepipenkoIgor commented 1 year ago

@GlauberF @Solat-Ali If you still have an errors please open new issue with stackblitz example and description by template

ahuemmer commented 1 year ago

Just for the records, in case anyone stumbles on this again in the future: I had and still have the same error message, but it is just displayed in my IDE (IntelliJ) for whatever reason. There's no problem compiling or running the app if you integrate ngx-mask as described in the README.

jeanseven commented 1 year ago

I use Angular version 15.1.0. Version of ngx-mask 15.1.0.

I have no error in console, however separator mask ruins my input logic with prices.

when unlimited type of price - I set and do on formControl setValue('unlimited').

In angular 13 it worked well, in Angular 15, the input text is empty, instead of my text.

also, separator mask don't allow me to use numbers after zero. only with backspace.