3.0.0 • Published 6 years ago

ng-input-password v3.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ng-input-password

Component for ionic 2 show/hide a value of password field

123
npm.ionpm.ionpm.io

Supported platforms

  • Android
  • Browser
  • iOS
  • Windows

Instalation

Open terminal in the root of your ionic 2 project

npm install --save ng-input-password

How to use

I) Normal use

1- Import the library NgInputPasswordComponent in your src/app/app.module.ts

...
import { NgInputPasswordComponent } from 'ng-input-password/ng-input-password';
...

2- In the same file (src/app/app.module.ts) add NgInputPasswordComponent in @NgModule

...
@NgModule({
  declarations: [
    NgInputPasswordComponent,
    ...
  ]
...

II) Lazy loading

1- Go in your yourpage.module.ts and add import

...
import { NgInputPasswordComponent } from 'ng-input-password/ng-input-password';
...

2- Then add NgInputPasswordComponent in declarations

@NgModule({
  declarations: [
    ...
    NgInputPasswordComponent
  ],
  imports: [
    ...
  ],

III)- Simply use ng-input-password tag in your code

...
<ng-input-password></ng-input-password>
...

Attributes

AttributeDescriptionTypeDefault
(ngModel)Bind data, value of the password input.any/
placeholderThe HTML placeholder attribute.stringPassword
iconThe icon of button show/hide password.stringeye
colorthe color of icon (if password is visible).stringprimary
hideColorthe color of icon (if password is hidden).stringdark
labelThe text of label.stringnot actived
labelStyleStyle of lable (floating / fixed).string/

NB: you can find icon list in ionic2 doc

Example

...
<ng-input-password 
    [(ngModel)] = "value" 
    placeholder = "password" 
    icon = "eye"
    color = "danger"
    hideColor = "secondary"
    label = "Password"
    labelStyle = "fixed" >
</ng-input-password>
...

NB: It is not necessary to use all attributes, (value is a variable in .ts file).