Skip to content

Instantly share code, notes, and snippets.

View NyaGarcia's full-sized avatar
🐈

Nya NyaGarcia

🐈
View GitHub Profile
@NyaGarcia
NyaGarcia / login-page.component.html
Last active October 28, 2021 14:44
Adding button to navigate register page
<div class="background">
<div class="login-container">
<div class="text-container">
<h1>Hey Stranger</h1>
<p>
Want to create an awesome account to access this awesome app? Go ahead
and click the button below!
</p>
<button mat-button routerLink="/register">Sign up</button>
</div>
@NyaGarcia
NyaGarcia / register-page.component.ts
Last active December 28, 2021 22:38
Implementing the register logic in the register page
import { Component, OnInit } from '@angular/core';
import { AuthService } from 'src/app/core/services/auth.service';
import { LoginData } from 'src/app/core/interfaces/login-data.interface';
import { Router } from '@angular/router';
@Component({
selector: 'app-register-page',
templateUrl: './register-page.component.html',
styleUrls: ['./register-page.component.css'],
@NyaGarcia
NyaGarcia / register-page.component.html
Created October 25, 2021 16:27
Adding the login form to the register page
<div class="container">
<h1>Welcome to NgBytes Register</h1>
<ngbytes-login-form (formData)="register($event)"></ngbytes-login-form>
</div>
@NyaGarcia
NyaGarcia / auth-routing.module.ts
Created October 25, 2021 15:59
Adding a register route
import { RouterModule, Routes } from '@angular/router';
import { LoginPageComponent } from './pages/login-page/login-page.component';
import { NgModule } from '@angular/core';
import { RegisterPageComponent } from './pages/register-page/register-page.component';
const routes: Routes = [
{ path: '', component: LoginPageComponent },
{ path: 'register', component: RegisterPageComponent },
];
@NyaGarcia
NyaGarcia / register-page.component.css
Created October 25, 2021 15:57
Adding styles to the register page
h1 {
color: #838383;
margin-bottom: 50px;
}
.container {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
@NyaGarcia
NyaGarcia / register-page.component.html
Created October 25, 2021 15:56
Creating a register page
<div class="container">
<h1>Welcome to NgBytes Register</h1>
</div>
@NyaGarcia
NyaGarcia / app-routing.module.ts
Last active October 29, 2021 11:10
Adding the auth module to the app-routing module
import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
const routes: Routes = [
{
path: '',
loadChildren: () =>
import('./features/auth/auth.module').then((m) => m.AuthModule),
},
@NyaGarcia
NyaGarcia / auth.service.ts
Last active December 28, 2021 22:09
Adding a register method to the auth service
import {
Auth,
createUserWithEmailAndPassword,
signInWithEmailAndPassword,
signOut,
} from '@angular/fire/auth';
import { Injectable } from '@angular/core';
import { LoginData } from '../interfaces/login-data.interface';
@NyaGarcia
NyaGarcia / auth.service.ts
Last active December 28, 2021 22:04
Creating a login method in the auth service
import { Auth, signInWithEmailAndPassword } from '@angular/fire/auth';
import { Injectable } from '@angular/core';
import { LoginData } from '../interfaces/login-data.interface';
@Injectable({
providedIn: 'root',
})
export class AuthService {
constructor(private auth: Auth) {}
@NyaGarcia
NyaGarcia / login-page.component.ts
Last active December 28, 2021 22:18
Adding a login method
import { Component, OnInit } from '@angular/core';
import { AuthService } from 'src/app/core/services/auth.service';
import { LoginData } from 'src/app/core/interfaces/login-data.interface';
import { Router } from '@angular/router';
@Component({
selector: 'app-login-page',
templateUrl: './login-page.component.html',
styleUrls: ['./login-page.component.css'],