JsDaddy / ngx-mask

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

Mask does not work #128

Closed dancornilov closed 6 years ago

dancornilov commented 6 years ago

Module: import {NgxMaskModule} from 'ngx-mask'; imports: [ NgxMaskModule.forRoot() ];

Component: <input [formControlName]="'phone'" type="text" mask="[00]-[000]-[000]" />

NepipenkoIgor commented 6 years ago

@dancornilov Hi, could you show your environment (package.json)???

dancornilov commented 6 years ago

"dependencies": { "@angular/animations": "6.0.2", "@angular/common": "6.0.2", "@angular/compiler": "6.0.2", "@angular/core": "6.0.2", "@angular/forms": "6.0.2", "@angular/http": "6.0.2", "@angular/platform-browser": "6.0.2", "@angular/platform-browser-dynamic": "6.0.2", "@angular/router": "6.0.2", "angular-6-social-login-temp": "^1.1.14", "angular2-jwt": "^0.2.3", "angularx-social-login": "^1.2.0", "core-js": "^2.5.7", "icon-font-generator": "^2.1.7", "ng-dynamic-component": "^3.0.0", "ng-pick-datetime": "^6.0.4", "ngx-mask": "^2.9.3", "rxjs": "^6.2.0", "rxjs-compat": "^6.2.0", "zone.js": "^0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "^0.6.7", "@angular/cli": "6.0.2", "@angular/compiler-cli": "6.0.2", "@angular/language-service": "6.0.2", "@types/jasmine": "^2.8.8", "@types/jasminewd2": "~2.0.2", "@types/node": "^6.0.112", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.4.3", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "^5.3.2", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "2.7.2" } }

dancornilov commented 6 years ago

Will somebody help me solve my problem?

NepipenkoIgor commented 6 years ago

@dancornilov Any error in console ?

dancornilov commented 6 years ago

@NepipenkoIgor no nothing, maybe should set any options?

NepipenkoIgor commented 6 years ago

@dancornilov Try latest version . I added [ and ] as default symbols for mask. By the way you could read doc and find section with customization.

lfreneda commented 5 years ago

@dancornilov, fixed?

kapilraghuwanshi commented 5 years ago

@dancornilov

I am using the latest one-

app.module.ts

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

export let options: Partial | (() => Partial);

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

Do not forget to add this line in your module - where you want to use it (not in app.module.ts): @NgModule({ imports: [ NgxMaskModule.forChild() ] })

paulobusato commented 5 years ago

Do not forget to add this line in your module - where you want to use it (not in app.module.ts): @NgModule({ imports: [ NgxMaskModule.forChild() ] })

This was missing for me :( thanks a lot !

gmrosa commented 5 years ago

I don't know why but it works that whay in angular ^8

in your app.module.ts

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

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

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

in the module where you want to use it

import { NgxMaskModule } from 'ngx-mask';

@NgModule({ imports: [ NgxMaskModule ]

cheers