How to do it...

Observe the following instructions:

  1. Create a new MyIonicInputDirective app using the blank template, as shown, and go into the MyIonicInputDirective folder:
$ ionic start MyIonicInputDirective blank
$ cd MyIonicInputDirective
  1. Open the ./src/app/pages/home/home.html file and replace the content with the following code:
<ion-header>  <ion-navbar color="danger">    <ion-title>      Login    </ion-title>  </ion-navbar></ion-header><ion-content padding>  <ion-list>    <ion-item>      <ion-input type="text" placeholder="Username" [(ngModel)]="username" [myIonicInput]="myStyles"></ion-input>    </ion-item>    <ion-item>      <ion-input type="password" placeholder="Password"></ion-input>    </ion-item>  </ion-list>  <p *ngIf="myStyles.showUsername" class="hint">

Get Ionic Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.