AndrewJBateman / ionic-angular-authUser

:clipboard: Ionic-Angular used to authenticate users so they can access a simple chat app. Take care if updating.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

⚑ Ionic Angular Authentication

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

πŸ“„ Table of contents

πŸ“š General info

  • Firebase Firestore Authentication used to create sign in and log in functions
  • Firebase Cloud Firestore stores users and messages in Collections.
  • Angular FormBuilder used to reduce the amount of boilerplate needed to build a form
  • rxjs map and switchmap operators used

πŸ“· Screenshots

screenshot

πŸ“Ά Technologies

πŸ’Ύ Setup

  • Create a Firebase project and add email authentication
  • Add Firebase config object to environment variables
  • npm i to install dependencies
  • ionic serve to start the server on _localhost://8100

πŸ’» Code Examples

  • extract from chat.page.html by Simon Grimm showing ternery expressions to change chat offset and scss class depending on user
	<ion-grid>
    <ion-row *ngFor="let message of messages | async">
      <ion-col size="9" class="message"
        [offset]="message.myMsg ? 3 : 0"
        [ngClass]="{ 'my-message': message.myMsg, 'other-message': !message.myMsg }">
        <b>{{ message.fromName }}</b><br>
        <span>{{ message.msg }}
        </span>
        <div class="time ion-text-right"><br>{{ message.createdAt?.toMillis().toString() | date:'short' }}</div>
      </ion-col>
    </ion-row>
  </ion-grid>

πŸ†’ Features

  • Use of ternery expressions to change chat box color and horizontal offset depending on which user chat item is shown

πŸ“‹ Status & To-do list

  • Status: Complete and working. Problem with dev. console persisting user login id which stops chat from showing user details correctly
  • To-do: Fix errors. Find out how to show more than one user email in chat with email username - problem is likely due to storing of user data even after logging out and logging in as a different user.

πŸ‘ Inspiration

πŸ“ License

  • This project is licensed under the terms of the MIT license.

βœ‰οΈ Contact

About

:clipboard: Ionic-Angular used to authenticate users so they can access a simple chat app. Take care if updating.

License:MIT License


Languages

Language:TypeScript 63.7%Language:SCSS 23.0%Language:HTML 9.8%Language:JavaScript 3.6%