要创建遮罩,请使用angular2 text mask。我不知道如何为电子邮件创建输入掩码。
尝试过:
public emailMask = [/[a-z]/, '@', /[a-z]/, '.', /[a-z]/ ]
但是没有任何效果。仅在前面的两个字符之间添加两个字符。如何为电子邮件创建输入掩码(欢迎使用其他2号角上的掩码工具)。
答案 0 :(得分:0)
您需要安装以下软件包:
Creating support/demos/image/jfc/Font2DTest/Font2DTest.jar
Creating support/demos/image/jfc/Metalworks/Metalworks.jar
Creating support/demos/image/jfc/Notepad/Notepad.jar
Creating support/demos/image/jfc/TableExample/TableExample.jar
Creating support/demos/image/jfc/TransparentRuler/TransparentRuler.jar
Creating support/demos/image/jfc/SampleTree/SampleTree.jar
Creating jre jimage
Creating jdk jimage
WARNING: Using incubator modules: jdk.incubator.httpclient
WARNING: Using incubator modules: jdk.incubator.httpclient
Finished building target 'all' in configuration 'windows-x86_64-normal-server-fastdebug'
需要将npm install --save angular2-text-mask
npm install --save text-mask-addons
添加到TextMaskModule
后:
例如(app.module.ts):
{name}.module.ts
然后将输入import { BrowserModule } from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { TextMaskModule } from 'angular2-text-mask';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
TextMaskModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
添加到textMask
:
例如(app.component.html):
{name}.component.html
之后,将<input [textMask]="{mask: emailMask}" placeholder="example@domain.com">
添加到emailMask
:
例如(app.component.ts):
{name}.component.ts