Using the new directive as attribute




Using the new directive as attribute

<!DOCTYPE html>
<html>
   <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">
   </script>
   <body ng-app="myApp">
      <w3-test-directive></w3-test-directive>
      <script>
         var app = angular.module("myApp", []);
         app.directive("w3TestDirective", function() {
            return {
              template : "<h1>Made by a directive!</h1>"
            };
         });
     </script>
   </body>
</html>

Output