Parse PDF Documents in Angular with PDFjs
Parse PDF documents with pdfjs in Angular

Parse PDF Documents in Angular with PDFjs

Generate a new Angular application, if you do not have one already: ng new PdfReader Download pdfjs-dist from npm: npm install pdfjs-dist Create a service under src folder using the following command: ng generate service PdfReader Replace the contents of the generated service with the following: import { Injectable }…

3 Comments

Replace All Occurrences of a String in JavaScript

If you have ever used the replace method on a JavaScript string, then you know that it does not quite work like other programming languages. The problem with replace method in JavaScript is that it only replaces the first occurrence of a string. In this post, I will show you…

0 Comments
How to Sort Array of Objects by Date in JavaScript
JavaScript Sort Array of Objects by Date

How to Sort Array of Objects by Date in JavaScript

I recently had to figure out how to use JavaScript sort to order objects by date property. JavaScript sort method is available on array objects in JavaScript. It mutates the array, which means it modifies the elements of the array while sorting. The sort method has excellent support across all…

2 Comments
JavaScript Arrays: Add, Remove, Loop, Copy
Working with Arrays in JavaScript

JavaScript Arrays: Add, Remove, Loop, Copy

JavaScript arrays are used to hold collection of objects. The global Array object is available for us to store numbers, strings, boolean values or even complex objects. Unlike most programming languages, JavaScript arrays are not strongly-typed. This means that you can store a mixture of data types in a JavaScript…

0 Comments
Easily Decode JSON Web Token (JWT) in Your SPA
Decode JWT Tokens in Angular

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. JWT tokens contain useful information about the authenticated user such as full name, email address and role details. In certain situations, it is often desirable to grab the details of the user…

3 Comments