首页 > 其他 > 详细

[Angular 2] Better ES5 Code

时间:2015-08-25 21:31:09      阅读:217      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>JS Bin</title>
    <script src="https://code.angularjs.org/2.0.0-alpha.28/angular2.sfx.dev.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>

<egghead></egghead>
<script src="app.js"></script>
</body>
</html>

 

var Note = angular
    .Component({
        selector: ‘note‘
    })
    .View({
        template: ‘<h3>World</h3>‘
    })
    .Class({
        constructor: function() {

        }
    });

var Egghead = angular
    .Component({
        selector: ‘egghead‘
    })
    .View({
        template: ‘<div><h1>Hello</h1><note></note></div>‘,
        directives: [Note]
    })
    .Class({
        constructor: function() {

        }
    });

document.addEventListener("DOMContentLoaded", function() {
    angular.bootstrap(Egghead);
});

 

[Angular 2] Better ES5 Code

原文:http://www.cnblogs.com/Answer1215/p/4758545.html

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