How to Make Angular Material Dialog Draggable with cdkDrag

With the Angular Material 7 release, an exciting feature we've been waiting for — drag and drop is available with the component dev kit. In my previous article, I explained how to create a reusable confirm dialog with Angular Material. Today, we’ll learn how to make the dialog draggable. We will…

Continue ReadingHow to Make Angular Material Dialog Draggable with cdkDrag

Select All Option for MatSelect

In this post, you'll learn how to implement select all option for mat-select from Angular Material. Our solution will involve creating a custom component that will be embedded inside a select dropdown. It will also support indeterminate mode of checkbox, meaning our new option will show a different icon based…

Continue ReadingSelect All Option for MatSelect

Angular Routing and Navigation Tutorial

Implement routing in Angular to enable navigation from one view to another. Users click buttons, anchor links and select options in drop-downs to perform tasks in web applications. Routing plays a key role in any modern web application and Angular makes it very easy to implement routing with router outlet.…

  • Post category:Angular
  • Post comments:0 Comments
  • Reading time:19 mins read
Continue ReadingAngular Routing and Navigation Tutorial

Downloading Files in Angular

In this post, I will show you how to download a file in Angular from a remote web API. CSV files, Excel spreadsheets, Word documents, PDF reports and images are common types of files that a functional Angular web app may need to download. In most cases, back-end APIs return…

  • Post category:Angular
  • Post comments:1 Comment
  • Reading time:6 mins read
Continue ReadingDownloading Files in Angular

How to Force Selection in Angular Material Autocomplete

In this post, we'll look at how to validate autocomplete component from Angular Material. Working with reactive forms, we'll write a custom validator to force selection only from the list of options. The autocomplete component is an input with a dropdown of suggested options. It allows the user to type…

Continue ReadingHow to Force Selection in Angular Material Autocomplete

Calendar Component in Angular Material

In this post, you'll learn how to use Angular Material calendar component without date picker input. The calendar component allows date selection in a month view, which could be useful for a wide range of use cases such as booking forms. In addition to displaying a calendar, we will validate…

Continue ReadingCalendar Component in Angular Material

Easily Decode JSON Web Token (JWT) in Your SPA

JSON Web Tokens (JWT) are commonly used in single page application frameworks like Angular for authentication and authorisation. In situations where you want grab the details of the user from the token, you need a way to decode it yourself. In this post, I will be using jwt-decode, which is…

  • Post category:TypeScript
  • Post comments:3 Comments
  • Reading time:6 mins read
Continue ReadingEasily Decode JSON Web Token (JWT) in Your SPA

How to Add Angular Material Components Correctly

In this post, I will show you how to add Angular Material components in an Angular application. Importing UI components directly in the app.module increases the size of the module. The root module should be easy to maintain. Importing a button is not a great idea here. For example, consider…

Continue ReadingHow to Add Angular Material Components Correctly

Creating a Scalable Angular Project Structure

In this post, we create a scalable Angular project structure that is ideal for medium to large applications. Introduction Although Angular CLI does a great job at generating a new project, it does not force you to use a specific folder structure. Your initial project contains a single module, which…

  • Post category:Angular
  • Post comments:5 Comments
  • Reading time:8 mins read
Continue ReadingCreating a Scalable Angular Project Structure

Global Error Handling in Angular – Step by Step Tutorial

In this post, we will implement global error handling in Angular. Global error handling is one of the first things I implement in a new project. It helps avoid repetitive try/catch blocks in Angular components, services or directives. It gives me confidence that all errors will be captured consistently. Create…

  • Post category:Angular
  • Post comments:0 Comments
  • Reading time:4 mins read
Continue ReadingGlobal Error Handling in Angular – Step by Step Tutorial