0

I am running Angular 11. I have not taken any action relating to updating Angular versions; I only installed one new package which is not working.

I ran npm i --save ngx-mask and it successfully installed version 15.0.2 (latest as of now), which I can verify in my package.json file.

I attempted to import the module using the following. I tried this in app.module.ts as well as in the module.ts file of the component.

import {NgxMaskModule,IConfig} from 'ngx-mask'

export const options: Partial<IConfig> | (() => Partial<IConfig>) = null;

@NgModule({
  (...)
  imports: [
    NgxMaskModule.forRoot(options)
  ]
  (...)
})

I am getting this error for the NgxMaskModule import

Module '"ngx-mask"' has no exported member 'NgxMaskModule'

And this error for the NgxMaskModule.forRoot(options) line in the Imports:

Value at position 55 in the NgModule.imports of AppModule is not a reference
  Value could not be determined statically.(-991010)
app.module.ts(248, 5): Unable to evaluate this expression statically.
app.module.ts(248, 5): Unknown reference.

What am I doing wrong? What do I need to do in order to use ngx-mask?

A. Patterson
  • 41
  • 2
  • 6

2 Answers2

2

try install new version:

npm i ngx-mask@13.1.13

next step import using directory:

import { NgxMaskModule} from 'ngx-mask/lib/ngx-mask.module';

  • Hello, you can use formatting on StackOverflow to make your answer easier to read. See https://stackoverflow.com/editing-help for more – AgainPsychoX Feb 05 '23 at 08:30
2

After quickly scanning through the documentation I'm afraid you're using the wrong approach to start using the ngx-mask package. As you said you installed version 15.0.2, but you're using the approach which is meant for versions < 15.0.0. The following URL to the documentation should help you to get up and running with ngx-mask version 15.0.2: link

Obviously, if you want to use your current approach, you can always downgrade the version of your ngx-mask package.

Frederik
  • 33
  • 1
  • 3