app.js.txt -------- // Define the AngularJS module var app = angular.module("directiveExampleApp", []); // Define a custom directive named 'customDirective' app.directive("customDirective", function () { return { restrict: "E", // restrict usage to elements template: '
This is a custom directive
', }; }); // Define the main controller app.controller("MainController", function ($scope) { // Initialize scope variables $scope.message = "Hello, AngularJS!"; $scope.inputText = "Type something..."; $scope.showText = true; }); index.htm.txt -------- AngularJS Directives Example

AngularJS Directives Example

Built-in Directives

ngBind:

ngModel:

ngShow: {{ message }}

Custom Directive