nick34992
4/8/2017 - 3:24 AM

HTML, AngularJS: Element Directive

HTML, AngularJS: Element Directive

<!DOCTYPE html>
<html>
    <head>
        <script src="lib/angular.min.js"></script>
        <script src="app.js"></script>
    </head>
    <body>
        <div ng-app="myApp">
            <script type="text/ng-template" id="my-template.html">
                <div ng-repeat="num in [1,2,3,4,5]">{{ num }}</div>
            </script>
            <my-directive></my-directive>
        </div>
    </body>
</html>
angular.module('myApp', [])
.directive('myDirective', function() {
    return {
        restrict: 'E',
        templateUrl: 'my-template.html'
    };
});