ngx-mask 21.1.0 → 22.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -178,7 +178,14 @@ NGX-MASK follows Angular's official support policy, supporting Active and LTS ve
178
178
 
179
179
  ## Quick Start
180
180
 
181
- ### For Angular 15+ (Standalone)
181
+ `ngx-mask` ships as a standalone directive (`NgxMaskDirective`) and pipe (`NgxMaskPipe`) — there is no `NgxMaskModule` in current versions. Configuration is registered through one of two provider functions:
182
+
183
+ - **`provideEnvironmentNgxMask(config?)`** — application-wide config. Use it once in `bootstrapApplication` / `app.config.ts` (or a root `NgModule`'s `providers`).
184
+ - **`provideNgxMask(config?)`** — injector-level config. Use it in a component's or feature's `providers` to configure/override the options for that subtree only.
185
+
186
+ Directive inputs (e.g. `[thousandSeparator]`) always override any provider config. See [USAGE.md](USAGE.md#configuration) for the full decision guide, examples, and common pitfalls.
187
+
188
+ ### Standalone Applications
182
189
 
183
190
  #### Application-wide Setup with Default Config
184
191
 
@@ -212,35 +219,36 @@ bootstrapApplication(AppComponent, { providers: [provideEnvironmentNgxMask(maskC
212
219
  export class MyFeatureComponent {}
213
220
  ```
214
221
 
215
- ### For Angular < 15 (NgModule)
222
+ ### NgModule-based Applications
216
223
 
217
- #### Application-wide Setup with Default Config
224
+ Module-based apps import the standalone directive/pipe into `imports` and register the provider function:
218
225
 
219
226
  ```typescript
220
- import { NgxMaskModule } from 'ngx-mask';
227
+ import { NgxMaskDirective, NgxMaskPipe, provideEnvironmentNgxMask } from 'ngx-mask';
221
228
 
222
- @NgModule({ imports: [NgxMaskModule.forRoot()] })
229
+ @NgModule({
230
+ imports: [NgxMaskDirective, NgxMaskPipe],
231
+ exports: [NgxMaskDirective, NgxMaskPipe],
232
+ providers: [provideEnvironmentNgxMask()],
233
+ })
223
234
  export class AppModule {}
224
235
  ```
225
236
 
226
- #### With Custom Configuration
227
-
228
- ```typescript
229
- import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask';
237
+ #### Migrating from ngx-mask ≤ 14 (`NgxMaskModule`)
230
238
 
231
- const maskConfig: Partial<NgxMaskConfig> = { validation: false };
239
+ `NgxMaskModule.forRoot()` / `forChild()` only exist in ngx-mask 14.x and older (Angular < 15):
232
240
 
241
+ ```typescript
242
+ // Before (ngx-mask <= 14)
233
243
  @NgModule({ imports: [NgxMaskModule.forRoot(maskConfig)] })
234
244
  export class AppModule {}
235
- ```
236
245
 
237
- #### Feature-level Configuration
238
-
239
- ```typescript
240
- import { NgxMaskModule } from 'ngx-mask';
241
-
242
- @NgModule({ imports: [NgxMaskModule.forChild()] })
243
- export class FeatureModule {}
246
+ // After (current ngx-mask)
247
+ @NgModule({
248
+ imports: [NgxMaskDirective],
249
+ providers: [provideEnvironmentNgxMask(maskConfig)],
250
+ })
251
+ export class AppModule {}
244
252
  ```
245
253
 
246
254
  ## Related Projects