Book Image

MEAN Blueprints

By : Robert Onodi
Book Image

MEAN Blueprints

By: Robert Onodi

Overview of this book

The MEAN stack is a combination of the most popular web development frameworks available—MongoDB, Angular, Express, and Node.js used together to offer a powerful and comprehensive full stack web development solution. It is the modern day web dev alternative to the old LAMP stack. It works by allowing AngularJS to handle the front end, and selecting Mongo, Express, and Node to handle the back-end development, which makes increasing sense to forward-thinking web developers. The MEAN stack is great if you want to prototype complex web applications. This book will enable you to build a better foundation for your AngularJS apps. Each chapter covers a complete, single, advanced end-to-end project. You’ll learn how to build complex real-life applications with the MEAN stack and few more advanced projects. You will become familiar with WebSockets and build real-time web applications, as well as create auto-destructing entities. Later, we will combine server-side rendering techniques with a single page application approach. You’ll build a fun project and see how to work with monetary data in Mongo. You will also find out how to a build real-time e-commerce application. By the end of this book, you will be a lot more confident in developing real-time, complex web applications using the MEAN stack.
Table of Contents (13 chapters)
MEAN Blueprints
About the Author
About the Reviewer

Displaying threads

A user must know in which conversation he/she is participating, so we need to display this information to the user. To do so, we are going to implement a thread listing component.

Thread component

In order to display a list of threads, we are going to use a component for each thread to encapsulate all the information displayed to the user and functionalities. To create the desired component, follow these steps:

  1. Create the component file, called public/src/thread/thread.component.ts.

  2. Import the necessary dependencies:

    import { Component, OnInit } from 'angular2/core';
    import { RouterLink } from 'angular2/router';
    import { ThreadService } from '../services/thread.service';
    import { Thread } from '../datatypes/thread';
  3. Add the component annotation:

        inputs: ['thread'],
        selector: 'thread',
        directives: [ RouterLink ],
        template: `
          <div class="thread-item">
            <a href="#" [routerLink]="['./ThreadMessages', { identifier: thread._id }]"...