Advertisement
Guest User

Untitled

a guest
Feb 13th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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. menu: any;
  33.  
  34.  
  35.  
  36. constructor(public navCtrl: NavController, public service: HomeService) { }
  37.  
  38. login() {
  39. this.service.getFunctions(this.user)
  40. .subscribe(
  41. datas => {
  42. if(datas.result){
  43.  
  44. console.log(datas)
  45.  
  46. this.navCtrl.push (menu)
  47.  
  48. }else{
  49.  
  50. alert("usuario ou senha inválido")
  51. });
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement