上QQ阅读APP看书,第一时间看更新
Introduction
Directives make up an important part in AngularJS applications with AngularJS. They manipulate the Document Object Model (DOM), route events to event handler functions, and much more. Through the use of custom directives, we can build applications with a rich user interface.
Although the built-in directives such as ng-repeat
, ng-show
, and ng-hide
cover many different scenarios, you will often need to create application-specific directives. This chapter will give you an overview on how to create and customize simple AngularJS directives, with the best practices in mind.
We assume that you already know what directives are, so let's check how to create and customize some simple directives to manipulate the DOM.