Advertisement
Guest User

Untitled

a guest
Feb 13th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2. import { NavController, ViewController } from 'ionic-angular';
  3.  
  4. import { HomeService } from './home.service';
  5. import { MenuPage } from './menu/menu';
  6.  
  7.  
  8. export class User {
  9. username: string;
  10. password: string;
  11. }
  12.  
  13.  
  14. @Component({
  15. selector: 'page-home',
  16. templateUrl: 'home.html',
  17. providers: [
  18. HomeService
  19. ]
  20. })
  21.  
  22. export class HomePage {
  23.  
  24. user: User = {
  25. username: '',
  26. password: ''
  27. }
  28.  
  29.  
  30.  
  31. items:any;
  32.  
  33.  
  34. constructor(public navCtrl: NavController, public service: HomeService) { }
  35.  
  36. login() {
  37. this.service.getFunctions(this.user)
  38. .subscribe(
  39. datas => {
  40. if(datas.result){
  41.  
  42. this.navCtrl.push(MenuPage, {
  43. username: datas.dados.id
  44. })
  45.  
  46. }else{
  47.  
  48. alert("usuario ou senha inválido")
  49. }
  50. });
  51.  
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement