Book Image

Learning Single-page Web Application Development

Book Image

Learning Single-page Web Application Development

Overview of this book

Table of Contents (15 chapters)
Learning Single-page Web Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Starting the baseline application


As with any web application, we kick off with creating a basic page. Later, we will discuss all the components that appear in the following example, but this time, we focus on the basic initialization of an AngularJS application:

<html ng-app>
  <head>
    <title>Angular baseline</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.min.js"></script>
  </head>
  <body>
    <input type="text" ng-model="name">
    <p>Hello: {{ name }}</p>
  </body>
</html>

By declaring the ng-app property on the html tag, we are initializing our application. It's the first of some new properties that we will use. The entire framework revolves around these new statements.

The ng-app property informs that our Document Object Model (DOM) and HTML document are also an AngularJS document. This property can be used in any element of the DOM. In many cases, only a single...