Advertisement
Guest User

Untitled

a guest
Nov 7th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. import { Component, trigger, state, style, transition, animate, keyframes } from '@angular/core';
  2. import {NavController} from 'ionic-angular';
  3. import {Login} from "../../pages/login/index";
  4. import {Platform} from "../../pages/platform/index";
  5. import { User } from '../../pages/user/index';
  6. import { OnInit } from '@angular/core';
  7. import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms';
  8.  
  9.  
  10. @Component({
  11. selector: 'page-register',
  12. templateUrl: 'registration.html',
  13.  
  14. animations: [
  15.  
  16. //For the logo
  17. trigger('flyInBottomSlow', [
  18. state('in', style({
  19. transform: 'translate3d(0,0,0)'
  20. })),
  21. transition('void => *', [
  22. style({transform: 'translate3d(0,2000px,0'}),
  23. animate('2000ms ease-in-out')
  24. ])
  25. ]),
  26.  
  27. //For the clouds
  28. trigger('flyInTopFast', [
  29. state('in', style({
  30. transform: 'translate3d(0,0,0)'
  31. })),
  32. transition('void => *', [
  33. style({transform: 'translate3d(0,1000px,0)'}),
  34. animate('1000ms ease-in-out')
  35. ])
  36. ]),
  37.  
  38. //For the background detail
  39. trigger('flyInBottomFast', [
  40. state('in', style({
  41. transform: 'translate3d(0,0,0)'
  42. })),
  43. transition('void => *', [
  44. style({transform: 'translate3d(0,2000px,0)'}),
  45. animate('1000ms ease-in-out')
  46. ])
  47. ]),
  48.  
  49. //For the login form
  50. trigger('bounceInBottom', [
  51. state('in', style({
  52. transform: 'translate3d(0,0,0)'
  53. })),
  54. transition('void => *', [
  55. animate('2000ms 200ms ease-in', keyframes([
  56. style({transform: 'translate3d(0,2000px,0)', offset: 0}),
  57. style({transform: 'translate3d(0,-20px,0)', offset: 0.9}),
  58. style({transform: 'translate3d(0,0,0)', offset: 1})
  59. ]))
  60. ])
  61. ]),
  62.  
  63. //For login button and tabs
  64. trigger('fadeIn', [
  65. state('in', style({
  66. opacity: 1
  67. })),
  68. transition('void => *', [
  69. style({opacity: 0}),
  70. animate('1000ms 2000ms ease-in')
  71. ])
  72. ])
  73. ]
  74. })
  75.  
  76. export class Registration {
  77. public registrationForm:any;
  78. tabState: any = "in";
  79. logoState: any = "in";
  80. stadiumState: any = "in";
  81. cloudState: any = "in";
  82. loginState: any = "in";
  83. formState: any = "in";
  84. cardState: any = "in";
  85.  
  86. public myForm: FormGroup; // our model driven form
  87. public submitted: boolean; // keep track on whether form is submitted
  88. public events: any[] = []; // use later to display form changes
  89.  
  90. constructor(private _fb: FormBuilder, public nav: NavController) { } // form builder simplify form initialization
  91.  
  92. ngOnInit() {
  93. this.myForm = new FormGroup({
  94. email: new FormControl('', [<any>Validators.required, <any>Validators.minLength(5)]),
  95. username: new FormControl('', [<any>Validators.required, <any>Validators.minLength(5)]),
  96. password: new FormControl('', [<any>Validators.required, <any>Validators.minLength(5)]),
  97. });
  98. }
  99.  
  100. save(model: User, isValid: boolean) {
  101. this.submitted = true; // set form submit to true
  102.  
  103. // check if model is valid
  104. // if valid, call API to save customer
  105. console.log(model, isValid);
  106. }
  107.  
  108. /*
  109. ionViewDidLoad() {
  110. this.registrationForm = this.form.group({
  111. email: ['', Validators.required],
  112. username: ['', Validators.compose([Validators.required, Validators.maxLength(100)])],
  113. password: ['', Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(100)])],
  114. passwordConfirm: ['', Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(100)])]
  115. })
  116. }
  117.  
  118. registerUser()
  119. {
  120. let email = this.registrationForm.controls.email.value;
  121. let username = this.registrationForm.controls.username.value;
  122. let password = this.registrationForm.controls.password.value;
  123. let passwordConfirm = this.registrationForm.controls.passwordConfirm.value;
  124. console.log(email);
  125. console.log(username);
  126. console.log(password);
  127. console.log(passwordConfirm);
  128.  
  129. this.nav.setRoot(Platform);
  130. }
  131.  
  132. loginTapped(){
  133. this.nav.setRoot(Login);
  134. }
  135. */
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement