Book Image

Hands-on Full Stack Development with Angular 5 and Firebase

By : Uttam Agarwal
Book Image

Hands-on Full Stack Development with Angular 5 and Firebase

By: Uttam Agarwal

Overview of this book

<p>This book is a complete package for you to build real-time web applications. You will build an end-to-end social networking web application from development to production with Angular as the frontend and Firebase as the backend.</p> <p>You will create an application called Friends with authentication, friends, and chat features. During the process, you’ll use Firebase authentication to register new users and Firebase database to store your extra user data. You’ll take a look at how to store and retrieve your user's images from Firebase storage. Then, you’ll create a real-time chat module with the Firebase database. Next, you’ll secure your database using Firebase security, make your application live with Firebase hosting, and develop your application with analytics.</p> <p>Moving on, you’ll take a look at how to create web pages using bootstrap with HTML, CSS, and TypeScript. You will use the angularfire2 library API in Angular services to interact with Firebase and write unit tests using the Jasmine framework that will help you to write a production-ready application. You’ll also discover various debugging techniques to troubleshoot any bug in your application. Finally, you’ll make your application Progressive Web Applications compliant.</p> <p>By the end of this book, you’ll be able to confidently build any complex application.</p>
Table of Contents (20 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Creating a chat message form component


In the chat message form component, we implement the message form to send the message to Firebase and update the list with a new message.

For these actions, we will require the following two elements:

  • Input with a text area: The input text allows a user to type their message. We use (key.enter) in the input text to handle the keyboard's Enter key, and this calls the sendMessage() method.
  • Send button: This calls the sendMessage() method and updates the Firebase database.

Here's the complete chat-message-form.component.html as of now:

<div class="chat-message-form-main-container">
    <div class="chat-message-form-container">
        <input type="textarea" placeholder="Type a message" 
         class="message-text" [(ngModel)]="newMessage" 
         (keyup.enter)="sendMessage()">
        <button (click)="sendMessage()" 
         class="btn btn-outline-success my-2 my-sm-0" 
         type="submit">SEND</button>
    </div&gt...