This example demonstrate the code sample for Directive Hello World program. Follow the instructions from this page to get started.
Instruction: Type your name in the text field below:


  • hello directive with name attribute
  • hello.html template used to display text and input field in above demo
  • HelloModule defining "hello" directive included as dependency in the angular app
Code Example
<!DOCTYPE html>
<html ng-app="HelloApp">
<title>AngularJS - Custom Directive Hello World - Code Example</title>
<link rel="stylesheet" type="text/css" href="">
<body ng-controller="HelloCtrl" class="container">
<div class="page-header"><h2>AngularJS - Custom Directive Hello World - Code Example</h2></div>
<hello name="Calvin Hobbes"></hello>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript">
angular.module('HelloApp', ['HelloModule'])
.controller('HelloCtrl', ['$scope', function($scope){

comments powered by Disqus