Categories
AngularJS

Client-side PDF Generation with AngularJS

Creating PDF’s with Client Side JavaScript Sucks!

I’ve learned that creating PDFs with JavaScript is not easy but it can be done and can be done well.  It can be done using HTML/CSS/JavaScript.  In this post, I’ll be using AngularJS but I’ve seen how this can be done with Angular as well.  There can be a lot of gotchas especially if you need it to work on mobile.

So let’s get to it!

Categories
AngularJS

Filtering Input Fields in AngularJS

What did I learn today?

Today, I came across a situation where I needed to have an input field containing a phone number format the number on page load and during user entry.  Formatting the phone number while the user was typing was easy, all it took was a pattern attribute and a simple directive.  But when I tried to use a filter to format the phone number on page load, it was more difficult than I expected.  The normal filter syntax was not usable and caused the screen to error.

Because I spent an hour or two looking for the best solution, I decided to write this blog post to remind me how to do this six month from now when I need to do this again.