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

Detailing directives, expressions, and scope


The first thing we notice when we look at the previous example is the presence of the np-app tag; this is known as directives, and in this specific example, it serves to tell AngularJS that all code contained within the body tag is an AngularJS application, as we mentioned before.

After this, we have ng-controller; as the name mentions, here we declare which controller will act on a certain region of HTML, and ng-repeat is something like a built-in loop over arrays. For simplicity, the tags, ng-app, ng-controller, and ng-repeat, are the AngularJS directives; there are many others as well.

To simplify, ng-atributtes (such as ng-app, ng-bind, ng-show, and ng-hide) are built-in directives of the framework; we can also create custom directives.

Tip

More information about Angular directives can be found at https://docs.angularjs.org/api/ng/directive.

Directives serve to extend the grammar of HTML and are simple statements but have powerful and flexible...