Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- registerUser()
- {
- if (this.newUser.password === this.newUser.passwordConfirm)
- {
- this.firebaseRef.createUser({email: this.newUser.email, password: this.newUser.password}, (error) => {
- if (error) {
- console.log(error);
- }
- });
- }
- else
- {
- console.log("Invalid passwords");
- }
- }
- import { Component, OnInit} from '@angular/core';
- import {FirebaseEventPipe} from "../firebasepipe";
- import {User} from "../classes/user";
- @Component({
- selector: 'registration',
- templateUrl: 'app/views/registration.component.html',
- pipes: [FirebaseEventPipe],
- })
- export class RegistrationComponent implements OnInit{
- private firebaseUrl: string;
- private firebaseRef: Firebase;
- newUser: User;
- submitted = false;
- constructor() {
- this.firebaseUrl = "https://<<myfirebaseurl>>.firebaseio.com/";
- this.firebaseRef = new Firebase(this.firebaseUrl);
- }
- registerUser()
- {
- if (this.newUser.password === this.newUser.passwordConfirm)
- {
- this.firebaseRef.createUser({email: this.newUser.email, password: this.newUser.password}, (error) => {
- if (error) {
- console.log(error);
- }
- });
- }
- else
- {
- console.log("Invalid passwords");
- }
- }
- ngOnInit():any {
- this.newUser = {email: '', password: '', passwordConfirm: ''}
- }
- // TODO: Remove this when we're done
- get diagnostic() { return JSON.stringify(this.newUser); }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement