Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. import {AboutPage} from '../about/about';
  2.  
  3. @Component({`
  4. selector: 'page-home',
  5. templateUrl: 'home.html'
  6. })
  7. export class HomePage {
  8. //txtUserName: string;
  9. //txtPassword: string;
  10. constructor(public navCtrl: NavController , public alertCtrl: AlertController) {
  11.  
  12. }
  13.  
  14.  
  15. myDefaultAlert( utitle:string , message:string)
  16. {
  17. let alert = this.alertCtrl.create({
  18. title: utitle ,
  19. subTitle: message,
  20. buttons:['ok']
  21.  
  22. })
  23. alert.present();
  24. }
  25.  
  26. test( txtUserName , txtPassword)
  27. {
  28. var txtUserNaem=document.getElementById("txtUserName");
  29. var txtPassword=document.getElementById("txtPassword");
  30.  
  31.  
  32. if( txtPassword.value !='123') //that show error
  33. {
  34. this.myDefaultAlert("Invalid Password Warning!","Plz Enter correct Password to Login")
  35. txtPassword.value=" "; //that show error
  36. txtPassword.focus="true"; //that show error
  37. }
  38. else
  39. {
  40. this.navCtrl.push(AboutPage ,{
  41.  
  42. val: 'how r you'
  43. });
  44. //this.myDefaultAlert("Wellcome",txtUser.getValue())
  45. }
  46.  
  47. }
  48.  
  49.  
  50.  
  51. }
  52.  
  53.  
  54. **.html file**
  55. <ion-header>
  56. <ion-navbar>
  57. <ion-title>
  58. <h1 align="center"> Login App </h1>
  59. </ion-title>
  60. </ion-navbar>
  61. </ion-header>
  62.  
  63. <ion-content padding>
  64.  
  65. <ion-list >
  66.  
  67. <ion-item>
  68. <ion-label floating >Username</ion-label>
  69. <ion-input type="text" id="txtUserName" ></ion-input>
  70. </ion-item>
  71.  
  72. <ion-item>
  73. <ion-label floating>Password</ion-label>
  74. <ion-input type="password" id="txtPassword"></ion-input>
  75. </ion-item>
  76.  
  77. </ion-list>
  78. <button class="button" ion-button full round (click)= " test(txtUserName,txtPassword); " >Login</button>
  79. </ion-content>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement