AngularJS - Directives

first directive

by Shashank Srivastava

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.13/angular.min.js"></script>
<div ng-app="myApp">
    <superman></superman>
</div>

JavaScript

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

myApp.directive('superman', function() {
    return {
        restrict: 'E',
        template: "<div> I am from Krypton. </div>"
    };
});