Angular firebase upload images - firebase

I am a beginner working with Angular 5 and firebase.
As practice I decided to create a blog.
My problem is that I can not upload my images in firestore. When I upload to Cloud storage and try to retrieve the download link, it does not register in firestore.
Take a look at my code and give me suggestions.
import { Component, OnInit } from '#angular/core';
import { AuthService } from 'src/app/shared/services/auth.service';
import { finalize } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { AngularFireStorage } from '#angular/fire/storage';
import { PostsService } from 'src/app/shared/services/posts.service';
import { ToastrService } from 'ngx-toastr';
import { Router } from '#angular/router';
#Component({
selector: 'app-posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.scss']
})
export class PostsComponent implements OnInit {
uploadPercent: Observable<number>;
downloadURL: Observable<string>;
title: string;
content: string;
description: string;
image: string = null;
constructor(private auth: AuthService,
private toast: ToastrService,
private postService: PostsService,
private store: AngularFireStorage,
private router: Router) { }
ngOnInit() {
}
createPost() {
// tslint:disable-next-line:prefer-const
let data = {
content: this.content,
image: this.image,
description: this.description,
publication: new Date(),
title: this.title
};
this.router.navigate(['/admin']);
this.postService.create(data);
this.title = '';
this.description = '';
this.content = '';
this.toast.success('Votre article a été publié');
}
uploadImage(event) {
// tslint:disable-next-line:prefer-const
let file = event.target.files[0];
// tslint:disable-next-line:prefer-const
let path = `posts/${file.name}`;
if (file.type.split('/')[0] !== 'image') {
return alert('Erreur, ce fichier n\'est pas une image');
} else {
// tslint:disable-next-line:prefer-const
let ref = this.store.ref(path);
// tslint:disable-next-line:prefer-const
let task = this.store.upload(path, file);
this.uploadPercent = task.percentageChanges();
console.log('Image chargée avec succès');
task.snapshotChanges().pipe(
finalize(() => {
this.downloadURL = ref.getDownloadURL();
this.downloadURL.subscribe(url => {
console.log(url);
});
}
)
).subscribe();
}
}
}
<div class="col-8">
<div class="input-group mb-3">
<div class="custom-file">
<input type="file" class="custom-file-input" id="inputGroupFile03" aria-describedby="inputGroupFileAddon03" (change)="uploadImage($event)" accept=".png,.jpg" [(ngModel)]="image">
<label class="custom-file-label" for="inputGroupFile03">Choisir une image</label>
</div>
</div>
<div class="progress" [hidden]="!uploadPercent">
<mat-progress-bar mode="determinate" value="{{ uploadPercent | async }}"></mat-progress-bar>
{{ uploadPercent | async }}
</div>
<div [hidden]="!image">
<img [src]="image || '//:0'">
</div>
<div class="form-group">
<label for="title"> Titre du post </label>
<input type="text" class="form-control" name="title" id="title" placeholder="Titre" required [(ngModel)]="title"/>
</div>
<div class="form-group">
<label for="description"> Description </label>
<input type="text" class="form-control" name="description" id="description" placeholder="Desciption"
data-toggle="tooltip" data-placement="top" title="Ajouter une breve description de l'article" required [(ngModel)]="description"/>
</div>
<div class="form-group">
<label for="content"> Contenu de l'artcle </label>
<textarea class="form-control" name="content" id="content" cols="15" rows="5" placeholder="..." required [(ngModel)]="content"></textarea>
</div>
<button class="btn btn-success btn-lg btn-block" (click)="createPost()">Poster l'article <i class="fa fa-paper-plane"
aria-hidden="true"></i>
</button>
</div>
enter image description here

Related

how coul i throw validations to a composable function vue 3

I am using vuelidate to validate my forms but seeing that the code is repetitive I wanted to make a composable function that validates a data object and the rules, but when I use the same ass function to compare the passwords, I get the following error
UserForm.vue:124 Uncaught (in promise) ReferenceError: Cannot access 'form' before initialization
certainly form is started after its invocation, I can't think how to send the rules to validate the passwords or any other field in the future.
this my vue 3 form component
<template>
<form #submit.prevent="submitForm" class="w-full">
<!-- nombre de usuario y nickname -->
<div class="main-box">
<div class="input-box">
<label class="label-item" for="grid-nick-name">
nombre de usuario
</label>
<input :class="[ !v$.nickname.$error ?'input-item' : 'input-item-error']" id="grid-nick-name" type="text" placeholder="user"
v-model="form.nickname">
<p class="error-msg" v-if="v$.nickname.$error">Porfavor rellena el campo</p>
</div>
<div class="input-box">
<label class="label-item" for="grid-name">
nombre
</label>
<input :class="[ !v$.name.$error ?'input-item' : 'input-item-error']" id="grid-name" type="text" placeholder="name lastname"
v-model="form.name">
<p class="error-msg" v-if="v$.name.$error">Porfavor rellena el campo</p>
</div>
</div>
<!-- document -->
<div class="main-box">
<div class="input-box-full">
<label class="label-item" for="grid-document">
Documento
</label>
<input :class="[ !v$.document.$error ?'input-item' : 'input-item-error']" id="grid-document" type="text" placeholder="00000000"
v-model="form.document">
<p class="error-msg" v-if="v$.document.$error">Campo vacio / datos invalidos</p>
</div>
</div>
<!-- password y password re -->
<div class="main-box">
<div class="input-box">
<label class="label-item" for="grid-password">
contraseña
</label>
<input :class="[ !v$.password.$error ?'input-item' : 'input-item-error']" id="grid-password" type="password" placeholder="*********"
v-model="form.password">
<p class="error-msg" v-if="v$.password.$error">Porfavor rellena el campo</p>
</div>
<div class="input-box">
<label class="label-item" for="grid-re-password">
repetir contraseña
</label>
<input :class="[ !v$.repassword.$error ?'input-item' : 'input-item-error']" id="grid-re-password" type="password" placeholder="*********"
v-model="form.repassword">
<p class="error-msg" v-if="v$.repassword.$error">Las Contraseñas deben coincidir</p>
</div>
</div>
<div class="main-box">
<div class="input-box">
<label class="label-item" for="grid-entity">
Entidad
</label>
<div class="relative">
<select :class="[ !v$.entity.$error ?'input-item' : 'input-item-error']" id="grid-entity" v-model="form.entity">
<option v-bind:value="'Hardware'">Hardware</option>
<option>Software</option>
<option>Red</option>
</select>
<div class="icon-item">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>
<div class="input-box">
<label class="label-item" for="grid-position">
Cargo
</label>
<div class="relative">
<select :class="[ !v$.position.$error ?'input-item' : 'input-item-error']" id="grid-position" v-model="form.position">
<option selected>Baja</option>
<option>Media</option>
<option>Alta</option>
</select>
<div class="icon-item">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>
</div>
<div>
<button type="submit"
class="submit-button">Guardar</button>
</div>
</form>
</template>
and this is the script vue 3 form component
<script setup>
import { required, numeric, alphaNum, sameAs, minLength } from '#vuelidate/validators';
import { useFormValidator } from "#/composables/useFormValidator.js";
const initialState = {
nickname:'',
name:'',
document:'',
password:'',
repassword:'',
entity:'',
position:'',
}
const validations = {
nickname: { required },
name: { required, alphaNum },
document: { required, numeric },
password: { required, minLength: minLength(6) },
repassword: { required, samePassword: sameAs(form.password)},
entity: { required },
position: { required },
}
const {
form,
v$,
submitForm
} = useFormValidator(initialState,validations);
</script>
here's my composable function validation
import { reactive } from '#vue/reactivity';
import useVuelidate from '#vuelidate/core';
import { computed, inject } from 'vue';
export const useFormValidator = (initialValue,validations) => {
const swal = inject('$swal');
const form = reactive({...initialValue});
const rules = computed(() => {
return {
...validations
}
});
const v$ = useVuelidate(rules,form);
const submitForm = async () => {
const isvalidForm = await v$.value.$validate();
if(!isvalidForm) return ;
else{
//aler succes
swal("Guardado!","el usuario a sido guardado correctamente","success");
//object initial state
Object.assign(form,initialValue);
//validations reset form
v$.value.$reset();
}
}
return {
form,
v$,
submitForm,
}
}
i need to passt diferent validation rules every time i use the composable

I can not insert a record into firestore database using angular 12

There is no error showing when i run ng serve or ng build, but it can't still make a record. I am blown away. Please help me.
I can show you some relevant parts in which i made some changes.
i created a student class in model.ts file, then i created an instance of the class in service class. Afterward, in build component of html file i created the submit() method as shown below
model.ts
export class Students{
id!: string;
matricule!:string;
nom!: string;
prenom!: string;
Quartier!:string;
age!:number
}
student.service.ts
import { AngularFirestoreDocument } from '#angular/fire/compat/firestore';
import { Students } from './model';
#Injectable({
providedIn: 'root'
})
export class StudentService {
constructor() { }
formData: Students = new Students();
}
student.component.ts
import { AngularFirestore } from '#angular/fire/compat/firestore';
import { NgForm } from '#angular/forms';
import { StudentService } from 'src/app/shared/student.service';
#Component({
selector: 'app-student',
templateUrl: './student.component.html',
styleUrls: ['./student.component.scss']
})
export class StudentComponent implements OnInit {
constructor(public service:StudentService, private firestore:AngularFirestore)
{ }
ngOnInit(): void {
this.resetForm();
}
resetForm(form?:NgForm) {
if(form!= null) {
form.resetForm();
this.service.formData = {
id:'',
matricule:'',
nom:'',
prenom:'',
age:0,
Quartier:''
}
}
}
onSubmit(form:NgForm) {
let data = form.value;
this.firestore.collection('students').add(data);
this.resetForm(form);
}
}
student.component.html
<form #form="ngForm" autocomplete="off" (submit)="onSubmit(form)">
<div class="form-group">
<input name="matricule" #matricule="ngModel" [(ngModel)]="service.formData.matricule" class="form-control" placeholder="Matricule" required>
<div *ngIf="matricule.invalid && matricule.touched" class="validation-error">Ce chant est obligatoire</div>
</div>
<div class="form-group">
<input name="nom" #nom="ngModel" [(ngModel)]="service.formData.nom" class="form-control" placeholder="Nom" required>
<div *ngIf="nom.invalid && nom.touched" class="validation-error">Ce chant est obligatoire</div>
</div>
<div class="form-group">
<input name="prenom" #prenom="ngModel" [(ngModel)]="service.formData.prenom" class="form-control" placeholder="Prenom" required>
<div *ngIf="prenom.invalid && prenom.touched" class="validation-error">Ce chant est obligatoire</div>
</div>
<div class="form-group">
<input type="number" name="age" #age="ngModel" [(ngModel)]="service.formData.age" class="form-control" placeholder="Age" required>
<div *ngIf="age.invalid && age.touched" class="validation-error">Ce chant est obligatoire</div>
</div>
<div class="form-group">
<input name="Quartier" #Quartier="ngModel" [(ngModel)]="service.formData.Quartier" class="form-control" placeholder="Quartier" required>
<div *ngIf="Quartier.invalid && Quartier.touched" class="validation-error">Ce chant est obligatoire</div>
</div>
<div class="form-group">
<button type="submit" [disabled]="form.invalid" class="btn btn-lg btn-block btn-info">SUBMIT</button>
</div>
</form>

Can't validate email with Vuelidate in Vue3

I'm trying to use validation option in a form. The app is developing under Vue3.
I have installed npm install #vuelidate/core #vuelidate/validator into project folder. In a file main.js I have been trying to add Vuelidate as following:
import { createApp } from 'vue'
import Vuelidate from 'vuelidate'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import 'materialize-css/dist/js/materialize.min'
createApp(App).use(store).use(router).use(Vuelidate).mount('#app')
Next I am working on Login.vue file as following
<template>
<form class="card auth-card" #submit.prevent="onSubmit">
<div class="card-content">
<span class="card-title">Example</span>
<div class="input-field">
<input
id="email"
type="text"
v-model.trim="email"
:class="{invalid: ($v.email.$dirty && !$v.email.required) || ($v.email.$dirty && !$v.email.email)}"
>
<label for="email">Email</label>
<small class="helper-text invalid"
v-if="$v.email.$dirty && !$v.email.required"
>Could not be empty</small>
<small class="helper-text invalid"
v-else-if="$v.email.$dirty && !$v.email.email"
>Incorrect form</small>
</div>
</div>
<div class="card-action">
<div>
<button
class="btn waves-effect waves-light auth-submit"
type="submit">
Enter-login
<i class="material-icons right">send</i>
</button>
</div>
</div>
</form>
</template>
<script>
import { email, required, minLength } from '#vuelidate/validators'
import useVuelidate from '#vuelidate/core'
export default {
name: 'login',
setup () {
return { v$: useVuelidate() }
},
data: () => ({
email: '',
password: ''
}),
validations: {
email: { email, required },
password: { required, minLength: minLength(6) }
},
methods: {
onSubmit () {
if (this.$v.$invalid) {
this.$v.$touch()
return
}
this.$router.push('/')
}
}
}
</script>
Then I try to run all that with npm run serve but with no success. Chrome DeveloperTools inform me about "Uncaught (in promise) TypeError: Cannot read property 'super' of undefined".
What did I do wrong? Is it possible to use Vue3 and Vuelidate together?
Lidia
Step 1: Import useVuelidate inside component
import useVuelidate from "#vuelidate/core";
import { email, required, minLength } from "#vuelidate/validators";
Step 2: Initalize useVuelidate inside component
setup() {
return { v$: useVuelidate() };
},
Step 3: Initalize your modal data
data() {
return {
email: '',
password: ''
};
},
Step 4: Add validations rule
validations() {
return {
email: { email, required },
password: { required, minLength: minLength(6) }
};
},
Step 5: Add form submit method
methods: {
onSubmit: function() {
this.v$.$touch();
if (this.v$.$error) return;
alert('Form is valid')
}
}
Step 6: HTML template design will be like,
<form class="card auth-card" #submit.prevent="onSubmit">
<div class="card-content">
<span class="card-title">Example</span>
<div class="input-field">
<label for="email">Email <span class="required">*</span></label>
<input id="email" type="text" v-model.trim="email">
<small class="error" v-for="(error, index) of v$.email.$errors" :key="index">
{{ capitalizeFirstLetter(error.$property) }} {{error.$message}}
</small>
</div>
<div class="input-field">
<label for="email">Password <span class="required">*</span></label>
<input id="email" type="text" v-model.trim="password">
<small class="error" v-for="(error, index) of v$.password.$errors" :key="index">
{{ capitalizeFirstLetter(error.$property) }} {{error.$message}}
</small>
</div>
</div>
<div class="card-action">
<div>
<button class="btn waves-effect waves-light auth-submit" type="submit"> Enter-login<i class="material-icons right">send</i>
</button>
</div>
</div>
</form>
</template>
DEMO

Firebase signInWithEmailAndPassword not working in vue.js

I'm trying to get the sign in part working on my webapp but it's not working properly.
Whenever I press the login button the page either refreshes and the url gets updated with the credentials and stays at the same page OR the router gets pushed and goes to the 'homepage' without logging the user in.
I also followed this guide for reference: https://blog.logrocket.com/vue-firebase-authentication/
What's weird is that the sign up part is working just fine.
SignIn.vue
<div class="card-body">
<form>
<!-- email -->
<div class="input-group form-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-user"></i></span>
</div>
<input id="email" type="email" class="form-control" name="email" placeholder="e-mail" value required autofocus v-model="form.email" />
</div>
<!-- password -->
<div class="input-group form-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-key"></i></span>
</div>
<input id="password" type="password" class="form-control" name="password" placeholder="password" required v-model="form.password" />
</div>
<!-- error -->
<div v-if="error" class="alert alert-danger animated shake">{{ error }}</div>
<br />
<!-- login -->
<div class="form-group d-flex justify-content-between">
<div class="row align-items-center remember"><input type="checkbox" v-model="form.rememberMe" />Remember Me</div>
<input type="submit" #click="submit" value="Login" class="btn float-right login_btn" />
</div>
</form>
</div>
Script in SignIn.vue
<script>
import firebase from 'firebase';
export default {
data() {
return {
form: {
email: '',
password: '',
rememberMe: false
},
error: null
};
},
methods: {
submit() {
firebase
.auth()
.signInWithEmailAndPassword(this.form.email, this.form.password)
.catch(err => {
this.error = err.message;
})
.then(data => {
this.$router.push({ name: 'home' });
});
}
}
};
</script>
Store.js
import Vue from 'vue';
import Vuex from 'vuex';
import profile from './modules/profile';
import authenticate from './modules/authenticate';
Vue.use(Vuex);
export default new Vuex.Store({
modules: {
profile,
authenticate
}
});
Authenticate.js in store
const state = {
user: {
loggedIn: false,
data: null
}
};
const getters = {
user(state) {
return state.user;
}
};
const mutations = {
SET_LOGGED_IN(state, value) {
state.user.loggedIn = value;
},
SET_USER(state, data) {
state.user.data = data;
}
};
const actions = {
fetchUser({ commit }, user) {
commit('SET_LOGGED_IN', user !== null);
if (user) {
commit('SET_USER', {
displayName: user.displayName,
email: user.email
});
} else {
commit('SET_USER', null);
}
}
};
export default {
state,
mutations,
actions,
getters
};
It is probably because you assign the submit type to your button, your form is submitted before the Firebase method is triggered.
You should change the button code from
<input type="submit" #click="submit" value="Login" class="btn float-right login_btn" />
to
<input type="button" #click="submit" value="Login" class="btn float-right login_btn" />
See the W3 specification for more detail on button types.

Angular2 submit a form to the server

I have googled for this problem and I found a lot of links which couldn't help me solve my problem. All I want to do is to send forms data to the controller. it goes to the controller but the data is not present in there.
here are my codes:
app.component.ts
import {Component, OnInit} from "angular2/core";
import {AsyncRoute, Router, RouteDefinition, ROUTER_PROVIDERS, RouteConfig, Location, ROUTER_DIRECTIVES, RouteParams} from "angular2/router";
import {CitiesComponent} from "./components/cities.component";
import { CitiesService } from './components/cities.service';
import { HTTP_PROVIDERS } from 'angular2/http';
import 'rxjs/Rx';
declare var System: any;
#Component({
selector: "app",
templateUrl: "/app/app.html",
providers: [CitiesService, HTTP_PROVIDERS, ROUTER_PROVIDERS],
directives: [ROUTER_DIRECTIVES]
})
export class AppComponent implements OnInit {
public routes: RouteDefinition[] = null;
constructor(private router: Router,
private location: Location) {
}
ngOnInit() {
if (this.routes === null) {
this.routes = [
new AsyncRoute({
path: "/City",
name: "City",
loader: () => System.import("app/components/cities.component").then(c => c["CitiesComponent"])
})
];
this.router.config(this.routes);
}
}
getLinkStyle(route: RouteDefinition) {
return this.location.path().indexOf(route.path) > -1;
}
}
cities.ts
export interface ICities {
Id: string;
State: string;
Title: string;
}
cities.component.ts
import {Component, OnInit} from "angular2/core";
import { FORM_DIRECTIVES } from 'angular2/common';
import { RouteParams, Router } from 'angular2/router';
import { ICities } from './cities';
import { CitiesService } from './cities.service';
#Component({
selector: "cities",
templateUrl: "/partial/cities",
directives: [FORM_DIRECTIVES]
})
export class CitiesComponent implements OnInit {
public City: ICities;
cities: ICities[];
errorMessage: string;
constructor(private _citiesService: CitiesService, private _router: Router,
private _routeParams: RouteParams) { }
ngOnInit() {
this._citiesService.getCities()
.subscribe(
cities => this.cities = cities,
error => this.errorMessage = <any>error);
//this.message = "anything!"
}
onSubmit(form: ICities): void {
console.log('you submitted value 23:', form);
this._citiesService.addCity(form);
}
}
cities.services.ts
import { Injectable } from 'angular2/core';
import { Http, Response, Headers, RequestOptions, RequestMethod, Request} from 'angular2/http';
import { Observable } from 'rxjs/Observable';
import { ICities } from './cities';
#Injectable()
export class CitiesService {
private _citiesInsert = '/Cities/CitiesInsert';
private _citiesList = '/Cities/GetCities';
constructor(private _http: Http) { }
getCities(): Observable<ICities[]> {
return this._http.get(this._citiesList)
.map((response: Response) => <ICities[]>response.json())
.do(data => console.log('All: ' + JSON.stringify(data)))
.catch(this.handleError);
}
addCity(city: ICities) {
let body = JSON.stringify({ city });
let headers = new Headers({ 'Content-Type': 'application/json' });
//let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
let options = new RequestOptions({ headers: headers });
var url = '/Cities/CitiesInsert';
this._http.post(this._citiesInsert, JSON.stringify(city), headers)
.map(this.extractData)
.catch(this.handleError)
.subscribe(
(res2) => {
console.log('subsribe %o', res2)
}
);
}
private extractData(res: Response) {
let body = res.json();
alert("extract data: " + body);
return body.data || {};
}
private handleError(error: Response) {
// in a real world app, we may send the server to some remote logging infrastructure
// instead of just logging it to the console
alert("error: " + error);
console.error(error);
return Observable.throw(error.json().error || 'Server error');
}
}
cities.cshtml
<cities>
<div class="col-md-12">
<div class="portlet box blue ">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i> مشخصات
</div>
<div class="tools">
<a title="" data-original-title="" href="" class="collapse"> </a>
<a title="" data-original-title="" href="#portlet-config" data-toggle="modal" class="config"> </a>
<a title="" data-original-title="" href="" class="reload"> </a>
<a title="" data-original-title="" href="" class="remove"> </a>
</div>
</div>
<div class="portlet-body form">
<form role="form" #f="ngForm" (ngSubmit)="onSubmit(f.value)" >
<div class="form-body">
<div class="row">
<div class="col-sm-8">
<div class="form-group">
<label>وضعیت</label>
<select ngControl="State" class="form-control input-small selectpicker">
<option value="ACTIVATED" selected="selected">فعال</option>
<option value="DEACTIVE">غیرفعال</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<div class="form-group">
<label>عنوان</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-envelope"></i>
</span>
<input class="form-control" ngControl ="Title" placeholder="عنوان شهر" type="text">
</div>
</div>
</div>
</div>
</div>
<div class="form-actions right">
<button class="btn">
<i class="fa fa-ban"></i> صرفنظر
</button>
<button class="btn green" type="submit">
<i class="fa fa-save"></i> ذخیره
</button>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="portlet mt-element-ribbon light portlet-fit ">
<div class="ribbon ribbon-right ribbon-clip ribbon-shadow ribbon-border-dash-hor ribbon-color-success uppercase">
<div class="ribbon-sub ribbon-clip ribbon-right"></div> لیست اطلاعات
</div>
<div class="portlet-title">
<div class="caption">
<i class="icon-layers font-green"></i>
<span class="caption-subject font-green bold uppercase">شهرها</span>
</div>
</div>
<div class="portlet-body">
<div class='table-responsive'>
<table class='table' *ngIf='cities && cities.length'>
<thead>
<tr>
<th>
Title
</th>
</tr>
</thead>
<tbody>
<tr *ngFor='#city of cities'>
<td>{{ city.Title }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</cities>
CitiesController.cs
[HttpPost]
public void CitiesInsert(Cities city)
{
Console.Write(city);
}
Try something like this:
<form [ngFormModel]="loginForm" (submit)="doLogin($event)"
and in your component
doLogin(event) {
console.log(this.loginForm.value);
event.preventDefault();
}

Resources