How to add a 'show password' toggle button on the right of a password input?

I’d like to write a password input, with a toggle button on the right to turn whether to show the password.
like this:
username: [username]
password: [******] show:(toggle)

however, I tried many times, but I can’t achieve the effect due to my unfamiliar with ionic.
thanks for any help.

try to change input type on show password

I think I’ve solved this by adding some margin.
Anyway, thanks!

<div class="list">
<label class="item item-input">
  <span class="input-label">用户名</span>
  <input type="text">

<label  class="item item-input">
  <span class="input-label">密码</span>

  <input ng-hide="shouldShowPassword" type="password" ng-model="password">
  <input ng-show="shouldShowPassword" type="text" ng-model="password">

  <label class="toggle toggle-assertive" style="margin-right: 10px">
    <input type="checkbox" ng-model="shouldShowPassword">
    <div class="track">
      <div class="handle"></div>

oh, no, the code above seems have some problem.
when I narrow my view or run on android device, the toggle button just disappear gradually…