Book Image

MongoDB, Express, Angular, and Node.js Fundamentals

By : Paul Oluyege
Book Image

MongoDB, Express, Angular, and Node.js Fundamentals

By: Paul Oluyege

Overview of this book

MongoDB, Express, Angular and Node.js Fundamentals is a practical guide to the tried-and-true production-ready MEAN stack, with tips and best practices. The book begins by demystifying the MEAN architecture. You’ll take a look at the features of the JavaScript libraries, technologies, and frameworks that make up a MEAN stack. With this book, you'll not only learn how to develop highly scalable, asynchronous, and event-driven APIs quickly with Express and Node.js, but you'll also be able put your full-stack skills to use by building two full-fledged MEAN applications from scratch. You’ll understand how to build a blogging application using the MEAN stack and get to grips with user authentication using MEAN. As you progress through the chapters, you’ll explore some old and new features of Angular, such as pipes, reactive forms, modules and optimizing apps, animations and unit testing, and much more. By the end of the book, you’ll get ready to take control of the MEAN stack and transform into a full-stack JavaScript developer, developing efficient web applications using Javascript technologies.
Table of Contents (9 chapters)
MongoDB, Express, Angular, and Node.js Fundamentals
Preface

Using Inbuilt Pipes, Custom Pipes, Custom Directives, and Observables


Angular Pipes

Pipes were initially referred to as a filter in Angular 1. They are used mainly for data transformation in HTML templates. The purpose of this feature is to reduce the complexity of tasks such as streaming data over a WebSocket, which involves getting data, transforming it, and then displaying it to users. Input data is converted into a desired output through the use of pipes.

For example, if we need a currency output of USD 1,000,000 and we have 1000000 as the data variable, then how do we achieve our output using the inbuilt pipe for currency in Angular?

We can achieve this by using a pipe with the | (pipe character) syntax in the template, as shown in the following snippet:

{{ 1000000 | currency : 'USD' }}

From the preceding code, we can see that the number 1000000 is converted into a currency string to be displayed in the template. The output is USD 1,000,000.

The output is fine-tuned by providing an optional...