Book Image

Data Oriented Development with Angularjs

Book Image

Data Oriented Development with Angularjs

Overview of this book

Table of Contents (17 chapters)
Data-oriented Development with AngularJS
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

If you've ever wanted to create database-backed Single Page Applications (SPAs), this book will show you how to do it using the power of AngularJS. Along the way, you'll also learn the best practices of AngularJS development and will see how to structure your frontend code that greatly improves maintainability. You'll also learn how to create custom controls using AngularJS directives.

If you've ever wondered how to write applications that update data in real time without refreshing your browsers or without employing server-side push technologies, then this book shows you how easy it is using Firebase and AngularFire. Firebase resembles the document-oriented NoSQL stores, so you'll also learn how to structure your data in Firebase. Finally, you'll use Firebase's anonymous authentication and other best practices learned along the way in a hands-on example application.

What this book covers

Chapter 1, AngularJS Rationale and Data Binding, talks about why AngularJS is needed and why you should choose AngularJS over other client-side/server-side frameworks. It also talks about data binding, shows a simple Hello World application, and an application that demonstrates two-way data binding.

Chapter 2, Working with Data, talks about the whys and hows of dependency injection in Angular. Then it talks about filters and promises and finally shows you how to do Ajax communication using $http and $resource services.

Chapter 3, Custom Controls, is all about directives. It shows how you can write custom elements, attributes, and so on, and also talks about isolate scopes, transclusion, and other stuff about directives.

Chapter 4, Firebase, talks about different types of persistence mechanisms and local versus hosted databases. It then talks about the value proposition of Firebase and discusses AngularFire. Finally, it shows how to structure data while using Firebase and also talks about denormalization.

Chapter 5, Getting Started with AngularFire, shows how to use AngularFire. It shows synchronized objects and arrays and also shows three-way data binding in action.

Chapter 6, Applied Angular and AngularFire, builds an example application that shows how to use Firebase's anonymous authentication. It shows the difference between Angular factory and service, which is a commonly confused topic. It also uses Angular best practices in the example application.

Appendix A, Yeoman, demonstrates the use of yo (for scaffolding), grunt, and gulp (for building) and bower (for dependency management) tools. It discusses the advantage of using these tools and also shows how to install them using Node Package Manager (NPM).

Appendix B, Git and Git Flow, introduces Git which is one of the most widely used version control systems today. It shows the most basic Git commands to help you get started with Git quickly. It also shows simple Git branching and merging, and introduces Git flow—a tool which prescribes a practical branching model and makes branching and merging a joy.

Appendix C, Editors and IDEs, talks about editors and IDEs that have good support for web (HTML, CSS, and JavaScript) development technologies. The obvious candidates are Visual Studio, Eclipse, and Sublime Text and oldies such as Emacs and Vim. It also highlights the support for AngularJS in Brackets (backed by Adobe) and WebStorm (by JetBrains).

What you need for this book

All that you need for the examples in this book is a good text editor that has support for HTML/JavaScript syntax highlighting and any modern PC/Laptop.

Who this book is for

This book helps beginner-level AngularJS developers to organize AngularJS applications by discussing important AngularJS concepts and best practices. If you are an experienced AngularJS developer, but haven't yet written directives or created custom HTML controls, then this book is ideal for you. This book also shows you how to build real-time apps using Firebase/AngularFire to store and sync data in real time.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We loaded the ngRoute module as a dependent of the routeApp module."

A block of code is set as follows:

'use strict';
app.service('employeeSvc', function () {

  var Employee = function (name, age) {
    this.name = name;
    this.age = age;
  };

Var getEmployees = function () {
    return [
      new Employee("First employee", 56),
      new Employee("Second employee", 44),
      new Employee("Last employee", 32)
    ];
  };

  // Public API
  this.Employee = Employee;
  this.getEmployees = getEmployees;
});

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<br>
<div>
  <h1>Employee data:</h1>
  <ul>
    <li ng-repeat="employee in employeeData.employees">
      Employee - {{employee.name}} is - {{employee.age}} years old
    </li>
  </ul>
</div>

Any command-line input or output is written as follows:

bower install underscore

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "For other extensions, the Install button is enabled."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.