首页 > 其他 > 详细

Angular学习(7)- 模板2

时间:2014-03-28 22:41:51      阅读:544      评论:0      收藏:0      [点我收藏+]

示例:

bubuko.com,布布扣
<!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" id="test.html">
        <div>Test Template</div>
    </script>
</body>
</html>
bubuko.com,布布扣

Angular学习(7)- 模板2,布布扣,bubuko.com

Angular学习(7)- 模板2

原文:http://www.cnblogs.com/HD/p/3630735.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!