From jQuery to AngularJS

From jQuery to AngularJS

A Mindset Migration Cookbook for jQuery Developers

About the Book

Learn Angular using the jQuery you already know

This migration cookbook serves as a kind of "Rosetta Stone" between jQuery and Angular. It contains over 60 recipes you can instantly use to learn idiomatic Angular. These bite-size solutions will help jQuery developers by comparing the jQuery library (v1.x) to equivalent concepts in the Angular toolkit (v1.x). Note that the recipes in this book do not cover Angular 2.0, as the API will most likely change between now, and when it becomes available. 

Nearly 50 Million Websites Use jQuery

jQuery is currently the world's most popular JavaScript library with approximately 50 million websites using it. However, that number is falling as developers build more and more complex web applications. A solid front-end framework, which provides more than cross-browser DOM manipulation is essential for modern websites. These sites are turning to Angular and similar tools that provide more robust architectures.

Over 200,000 Websites Use Angular

In contrast, the number of sites using Angular is growing rapidly. There is no doubt that Angular is a rising star in the front-end web development community. The toolset provides a solid foundation for building ambitious web applications that are maintainable and scale.

The Goal of This Book

This book is designed to help developers proficient with jQuery transition to the AngularJS toolset. Its purpose is not to convince you of the merits of Angular. Rather, I assume you have decided that given your application context, it would be beneficial for you to migrate from jQuery to Angular.

There are a several factors that will help you decide whether or not to use Angular. First consider where you want to put your application logic, server-side or client-side. The more things you need to push down to the client, the more likely Angular will better fit your needs.

Some questions to ask yourself: Are you creating a single page application where URL-to-resource routing is in JavaScript, or do you want that server-side? Will you be merging data with templates on the server, on the client or both? How important is it to you that your client-side code be testable? While it is possible to unit test jQuery code, the way most developers write nested callbacks tightly coupled to event handlers, does not lend itself readily to isolated testing. Finally, you need to decide if your team wants to embrace the declarative style of application development advocated by Angular. For example using the directive ng-click vs. $(elm).click(). Migrating from jQuery to Angular is a decision that you should carefully weigh, as it will most likely require a change in mindset.

Who This Book Is For

This book assumes a basic understanding of JavaScript programming and familiarity with jQuery. If you are unaccustomed to working with JavaScript, I suggest you get some of the basics under your belt first by reading a small book from Douglas Crockford called JavaScript the Good Parts.

Pedagogy of This Book

The migration recipes in this book are in a clear Problem, Solution, Discussion format you can instantly use to solve particular problems. Approximately one-third of this book compares complementary methods from the jQuery API with built-in functions provided in the Angular toolset. While the remaining two-thirds describe exactly how to migrate from a given imperative jQuery method to a declarative directive in Angular, and how to test it.

Table of Contents
  • Chapter 1, Effects
  • Chapter 2, Element Value
  • Chapter 3, Element Display
  • Chapter 4, Element State
  • Chapter 5, End-to-End Testing
  • Chapter 6, Events
  • Chapter 7, Remote Data
  • Chapter 8, Unit Testing
  • Chapter 9, Utilities
  • Chapter 10, Validation
  • Share this book

  • Categories

    • Software
    • Agile
    • Management
    • Cookbooks
    • DIY
    • Self-Help
    • Startups
    • Textbooks
  • Feedback

    Email the Author(s)

About the Author

Danny Lamb
Danny Lamb

Daniel Lamb is a talented senior software development professional with an extensive 15 years experience specializing in large-scale front-end architecture and web development in a fast-paced agile environment across multiple teams for millions of users.

Daniel's philosophy on front-end web development is to lead developer adoption in building web applications using JavaScript best practices and web standards markup. Leveraging unit test coverage to enable fearless refactoring and code reviews to maintain high quality.

Specialties include Front-end Development Architecture & Design Patterns, Advanced Object-Oriented JavaScript, Latency Optimization, Technical Leadership, Client-Side Technologies, and Cross-Browser Compatibility.

Follow him on GitHub and Twitter @daniellmb.

Causes Supported

Code Club

https://www.codeclub.org.uk

A nationwide network of volunteer-led after school coding clubs for children aged 9-11.

We create projects for our volunteers to teach at after school coding clubs or at non-school venues such as libraries. The projects we make teach children how to program by showing them how to make computer games, animations and websites. Our volunteers go to their local club for an hour a week and teach one project a week. Each term the students will progress and learn more whilst at the same time using their imaginations and making creative projects. Terms 1 & 2 use Scratch to teach the basics of programming. Term 3 teaches the basics of web development using HTML and CSS. Term 4 teaches Python and so on. We’d like to put a Code Club in every single primary school in the country. There are over 21,000 primary schools in the UK, it’s a big task but we think we can do it!

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub