The First AngularJS App

In app.js, we created a new module named myApp. A module contains the different components of an AngularJS app.

var app = angular.module("myApp", []);

Then, in index.html we added <body ng-app="myApp">. The ng-app is called a directive. It tells AngularJS that t......

Using Directives in AngularJS

Why is creating your own directives useful?

Readability. Directives let you write expressive HTML. Looking at index.html you can understand the app's behavior just by reading the HTML.

Reusability. Directives let you create self-contained units of functionality. We could easily plug in this di......