Book Image

AngularJS by Example

By : Chandermani
Book Image

AngularJS by Example

By: Chandermani

Overview of this book

<p>AngularJS makes web JavaScript web development less painful and more organized – it’s unsurprising that today it’s one of the most popular tools in web development.</p> <p>AngularJS by Example helps you get started with this essential web development framework quickly and easily, guiding you through AngularJS by showing you how to create your own real-world applications. By adopting this approach, you can bridge the gap between learning and doing immediately, as you follow the examples to learn the impressive features of Angular and experience a radically simple–and powerful–approach to web development.</p> <p>You’ll begin by creating a simple Guess the Number game, which will help you get to grips with the core components of Angular, including its MVC architecture, and learn how each part interacts with one another. This will give you a solid foundation of knowledge from which you can begin to build more complex applications, such as a 7 minute workout app and an extended personal trainer app. By creating these applications yourself, you will find out how AngularJS manages client-server interactions and how to effectively utilize directives to develop applications further. You’ll also find information on testing your app with tools such as Jasmine, as well as tips and tricks for some of the most common challenges of developing with AngularJS.</p> <p>AngularJS by Example is a unique web development book that will help you get to grips with AngularJS and explore a powerful solution for developing single page applications.</p>
Table of Contents (15 chapters)
AngularJS by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 1. Getting Started

Developing applications in JavaScript is always a challenge. Due to its malleable nature and lack of type checking, building a decent size application in JavaScript is difficult. Moreover, we use JavaScript for all types of processes such as User Interface (UI) manipulation, client server interaction, and business processing/validations. As a result, we end up with spaghetti code that is difficult to maintain and test.

Libraries such as jQuery do a great job of taking care of various browser quirks and providing constructs that can lead to an overall reduction in lines of code. However, these libraries lack any structural guidance that can help us when the codebase grows.

This is where architectural patterns such as Model View Controller (MVC) and frameworks such as AngularJS come into the picture. This chapter is dedicated to understanding the concept behind MVC architecture and learning how to put these principles into practice while we build a simple app using AngularJS.

The topics that we will cover in this chapter are as follows:

  • MVC basics: We will talk in brief about each of the components of the Model-View-Controller pattern.

  • Building our first AngularJS app: We will build a small game, Guess the Number! in AngularJS.

  • Understanding the Model, View, and Controller components: We will dissect the game that we built to understand the MVC components of AngularJS.

  • Working with scopes: AngularJS scopes are an important concept to understand. This chapter will introduce us to scopes and the role they play in the framework.

  • An introduction to some AngularJS constructs: We will introduce some new constructs such as expressions, directives, and interpolations that we used to build the Guess the Number! app.

  • App initialization: We will talk about the app initialization process in AngularJS; this is also known as App bootstrapping.

  • Lastly, we will provide some resources and tools that will come in handy during AngularJS development and debugging.

So let's get started with our first topic: MVC.