Angular学习,7- 模板2

示例:

<!DOCTYPE html>
<html ng-app="MyApp">
<head>
    <title>Study 8</title>
    <script type="text/javascript" src="js/angular.js"></script>
</head>
<body>
    <hello>Robin</hello>
    <test-template></test-template>
    
    <script type="text/javascript">
        var app = angular.module("MyApp", [], function() { });
        app.directive("hello", function() {
            return {
                restrict: 'E',
                template: "<div>Hello,<b ng-transclude></b></div>",
                replace: true,
                transclude : true
            };
        });

        app.directive("testTemplate", function() {
            return {
                restrict: 'E',
                templateUrl: "test.html",
                replace: true
            };
        });
    </script>
    
    <script type="text/ng-template" >
        <div>Test Template</div>
    </script>
</body>
</html>