Advertisement
ayami123

signup.ts

Jan 10th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component } from '@angular/core';
  2. import { IonicPage, NavController, NavParams } from 'ionic-angular';
  3. //import { TabsPage } from '../tabs/tabs';
  4. import { LoginPage } from '../login/login';
  5. import { SignUpContainer } from './signup.model';
  6. import { SignUpServiceProvider } from '../../providers/sign-up-service/sign-up-service';
  7. // import { AuthServiceProvider } from '../../providers/auth-service/auth-service';
  8.  
  9.  
  10. /**
  11.  * Generated class for the SignupPage page.
  12.  *
  13.  * See https://ionicframework.com/docs/components/#navigation for more info on
  14.  * Ionic pages and navigation.
  15.  */
  16.  
  17. @IonicPage()
  18. @Component({
  19.   selector: 'page-signup',
  20.   templateUrl: 'signup.html',
  21. })
  22. export class SignupPage {
  23.   // responseData : any;
  24.   // userData = {"username": "","password": "", "name": "","email": ""};
  25.   companies:any;
  26.   public SignUpContainer: SignUpContainer;
  27.  
  28.   test:any;
  29.   constructor(
  30.     public navCtrl: NavController,
  31.     public navParams: NavParams,
  32.     public signUpService: SignUpServiceProvider,
  33.   ) {
  34.     this.SignUpContainer = new SignUpContainer();
  35.     this.signUpService.loadAll().then(result => {
  36.         this.companies = result;
  37.     })
  38.   }
  39.  
  40.   ionViewDidLoad() {
  41.     console.log('ionViewDidLoad SignupPage');
  42.   }
  43.  
  44.   signup(){
  45.     console.log(this.companies);
  46.     this.signUpService.postData(this.SignUpContainer).then((response) => {
  47.       console.log(response);
  48.       console.log("success");
  49.     }, (error) => {
  50.       console.log("error"+ error);
  51.     });
  52.  }
  53.  
  54.  login(){
  55.    //Login page link
  56.    this.navCtrl.push(LoginPage);
  57.  }
  58.  
  59. }
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.   //   signup    
  70.   // localStorage.setItem('RegisterData', JSON.stringify(this.SignUpContainer));
  71.   //console.log();
  72.   // console.log(this.signUpService.postData(this.SignUpContainer));
  73.   //console.log(this.SignUpContainer);
  74.   //   this.authService.postData(this.userData,'signup').then((result) => {
  75.   //    this.responseData = result;
  76.   //    if(this.responseData.userData){
  77.   //    console.log(this.responseData);
  78.   //    localStorage.setItem('userData', JSON.stringify(this.responseData));
  79.   //    this.navCtrl.push(TabsPage);
  80.   //    }
  81.   //    else{ console.log("User already exists"); }
  82.   //  }, (err) => {
  83.   //    // Error log
  84.   //  });
  85.  
  86.   //  if(this.responseData.userData){
  87.   //   console.log(this.responseData);
  88.   //   localStorage.setItem('userData', JSON.stringify(this.responseData));
  89.   //    this.navCtrl.push(TabsPage);
  90.   //   }
  91.   //   else{ console.log("User already exists"); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement