Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
angular2-text-mask
Advanced tools
First, install it.
npm i angular2-text-mask --save
Then, import it into your @NgModule
:
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextMaskModule } from 'angular2-text-mask';
@NgModule({
imports: [
FormsModule,
TextMaskModule
],
declarations: []
})
export class MyModule {}
Then, use it in your component:
@Component({
selector: 'app',
template: `
<input [textMask]="{mask: mask}" [(ngModel)]="myModel" type="text"/>
`
})
export class AppComponent {
public myModel = ''
public mask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
}
As you can see in the code above, you are passing an object to the textMask
directive.
📍 For more information about the values that the textMask
object accepts, see
this page.
Text Mask does not provide an option to unmask the model before storing it. You can sanitize the model on your side. See here for details.
change
doesn't workchange
on an input field will not work if [text-mask]
is present. You can use (ngModelChange)
instead. For more
information, see this page.
To see an example of the code running, follow these steps:
git clone git@github.com:text-mask/text-mask.git
cd text-mask
cd angular2
npm install
npm start
The code of the example is in angular2/example
.
Unfortunately, we are unable to support Ionic 2 ion-input
at this point as it overrides the ControlValueAccessor
that Text Mask requires to perform its job.
FAQs
Angular 2 directive for input text masking
The npm package angular2-text-mask receives a total of 23,739 weekly downloads. As such, angular2-text-mask popularity was classified as popular.
We found that angular2-text-mask demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.