Preface

The world of software development has changed drastically over the last few decades. Many software methodologies and concepts that were considered “cutting edge” 20 or so years ago are now common practice in the field of software development, and have been for years. One example is the World Wide Web and the use of web browsers to deliver software to users. In 1993, the concept of delivering software over the Internet that could then run in a web browser on any machine running on any operating system was considered bleeding edge. But as any computer user knows, that practice has been commonplace for years now.

When JavaScript client-side web application frameworks like AngularJS, Backbone.js, and Ember.js first appeared, they were considered too cutting edge for most serious software projects. As they matured, however, software architects and developers saw great potential in these frameworks. Applications built with JavaScript client-side frameworks exist and run entirely on the user’s hardware, much like conventional thick-client applications. Applications written using these frameworks are much faster than conventional web applications and provide a much better user experience.

Over the last couple of years, JavaScript client-side frameworks have made great strides in functionality and reliability, and they are now heavily used to build mobile HTML5 applications. But mobile applications are only the starting point. These frameworks now have the potential to radically change the way we build modern web application software. Of all the JavaScript frameworks available, AngularJS, backed by Google, is the one that shines the brightest.

AngularJS has many advantages over other JavaScript client-side frameworks. AngularJS uses the MVC design pattern and embraces that pattern completely. The model, view, and controller are all clearly defined in AngularJS and serve to greatly simplify the development process. With AngularJS, developers can build applications that have a clear separation between their functional layers. 

One of the greatest advantages of AngularJS over other JavaScript client-side frameworks is the unique way in which it lets developers interact with RESTful web services. AngularJS’s resource object lets developers interact with REST services like standard objects. The complexity of REST services can be greatly simplified using this approach: with only a few lines of code, you can create an AngularJS service that interacts with multiple backend REST services. Those services can then be used throughout your application, reducing the total number of lines of code.

In fact, one of the biggest advantages of AngularJS over other client-side frameworks is its concept of services. AngularJS services help to greatly simplify an application by compartmentalizing client-side logic into single units of code. Those single units, called services, can then be used repeatedly throughout an application. AngularJS services prove especially powerful when you’re building large enterprise applications with many lines of code and much complexity. Complex logic can be written only once inside an AngularJS service and then used wherever needed. That alone makes AngularJS the best choice for your next JavaScript project.

Thanks to this use of services and its all-inclusive design, AngularJS helps developers write less code, thereby greatly reducing application complexity. The simplicity of AngularJS makes it easy to learn and easy to use. Any time spent learning AngularJS is time well spent. Any time spent developing AngularJS applications is time spent turning a cutting-edge technology into a commonplace technology. In this book I strive to help you do both, encouraging design concepts and practices that will help you build better AngularJS applications.

Why I Wrote This Book

I constantly see development teams avoid using AngularJS because of its perceived steep learning curve. Those same teams often choose other JavaScript frameworks because they initially seem easier to learn. But AngularJS is not hard to learn at all. It is actually much easier to learn than other JavaScript frameworks, if the learning process is approached correctly. Like many others, I struggled to learn AngularJS in the beginning. This book was written to help developers avoid the early struggles associated with learning AngularJS and get started building AngularJS applications and websites very quickly.

What This Book Covers

This book covers everything you need to know to build fully functional AngularJS applications. The book starts off with the basics of AngularJS. You will learn about AngularJS components in early chapters. As chapters progress, you will get hands-on experience building working AngularJS projects.

Near the end of the book, you will write the AngularJS part of a working MEAN stack blog application and deploy the application to the cloud. MEAN stands for MongoDB, ExpressJS, AngularJS, and Node.js. Many industry experts believe the MEAN stack will be a dominant web development platform in coming years.

After reading this book, you will have the knowledge to start building high-quality AngularJS applications and websites. You will also gain a clear understanding of the design concepts associated with AngularJS applications, and of security as it relates to AngularJS applications.

Who Should Read This Book

This book is intended for anyone who has an interest in learning to develop AngularJS applications or websites quickly. It will also be helpful to anyone interested in learning how AngularJS is used in a MEAN stack application. The reader will gain not only a conceptual understanding of AngularJS, but hands-on experience as well. Anyone reading this book should have some knowledge of JavaScript, software design concepts, and software design patterns. A prior knowledge of web development will also be helpful.

The Chapters in This Book

This book starts off with the very basics of AngularJS and assumes the reader has no prior knowledge of the framework. The chapters are arranged as follows: 

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Note

This element signifies a general note.

Warning

This element signifies a warning or caution.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/KenWilliamson.

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Learning AngularJS by Ken Williamson (O’Reilly). Copyright 2015 Ken Williamson, 978-1-491-91675-9.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/learning-angularjs.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.